metadata in the protocol
JSON payload
Field reference
id: 32-byte hex string (0x-prefixed). The first 20 bytes encode the expected on-chain market creator address; the remaining 12 bytes are random entropy. This is the same as theCreateMarketParams.questionIdfield.text: Primary market question shown in long-form contexts.shortText: Condensed question for cards and summaries.criteria: Resolution instructions. Conventionally begins with “Resolves YES if” and may include bullet points.endTime: Unix timestamp (seconds) for when resolution should occur.sources: Array of strings pointing to the data sources used by the oracle (e.g.https://x.com/<handle>). The Context frontend currently expects X accounts.explanation(optional): Short moderation or quality note. Omit entirely if unused.
Encoding
- Build the JSON object above with UTF-8 text.
- Convert the JSON string to bytes using UTF-8.
- Compress the bytes with gzip (DEFLATE). Any gzip implementation that produces a standard gzip container is acceptable.
- Hex-encode the compressed bytes (lowercase hex) and prepend
0x. - Submit that string as the
metadatafield when calling the smart contract.
Decoding
- Take the on-chain string and strip the leading
0x. - Hex-decode the remainder into raw bytes.
- Gunzip the bytes to recover the original JSON string.
- Parse the JSON into the schema described above.
Still have questions?
Ask in Discord.