Skip to Content
Draft v0.2 — this specification is under active design and may change before implementation.
Resolver APIVerifying the definition

Verifying the definition

Two of the three checks below are independent of Melee: the definition hash and the outcome address set can be verified from your own records and a Solana RPC. The third, the bound authorities, is attested by Melee (the on-chain account layout is not published); it protects you against Melee’s own mistakes, not against a hostile Melee.

1. Hash

Fetch GET /markets/{market}/definition, recompute sha256(canonicalJson(definition)) using RFC 8785 , and confirm it equals a hash you accepted (or a rules version you set yourself). Every version in the response carries the evidence you signed.

2. Outcome set

Outcome accounts are program-derived addresses with fixed seeds:

outcome_i = findProgramAddress([ utf8("outcome"), bytes32(marketPubkey), u8(i) ], programId)

Seed encodings: "outcome" as its 7 ASCII bytes; marketPubkey as the raw 32-byte public key (decode the base58); i as a single byte. programId must be one of the ids listed by GET /platform/programs for the network; do not derive against an id you have not validated (see Environments & testing).

For the n labels you accepted:

  1. Derive outcome_0 … outcome_{n-1}.
  2. Confirm each account exists and is owned by programId (getMultipleAccounts at confirmed commitment).
  3. Confirm outcome_n does not exist (no extra outcome was added behind you).
  4. Recompute outcomeSetHash = sha256(outcome_0 || … || outcome_{n-1}) over the raw 32-byte keys in index order, hex lowercase, and compare with the payload. After an outcome add, the hash covers all n+1 outcomes even though applied lists only the new one.

If your RPC lags Melee’s, an account may not be visible for a few seconds after live or applied; retry within the handshake timeout before answering.

A worked derivation in JavaScript is in the Integration reference.

3. Authorities

onChain.authorities.resolverAuthority and proposerAuthority must equal resolver.resolverAuthority and resolver.proposerAuthority in the definition version you accepted (they are inside the hash you signed). The onChain values are read by Melee from the market account; independent decoding is not available in this version, so this check catches Melee’s mistakes rather than a hostile Melee.

If a check fails

Do not act. Report Dispute (or hold at Resolving) with a message, and contact your Melee integration lead. Melee treats any drift it detects as a defect on its side and, for a live market, may void it (PlatformVoided with AuthorityDrift or DefinitionDrift).

Labels remain off-chain by construction; the address set plus the definition hash is the binding.

Definition endpoint response

{ "marketPubkey": "9xQe…", "current": { "version": 3, "definitionHash": "9f2a…", "definition": { "…": "…" } }, "versions": [ { "version": 1, "definitionHash": "…", "changeType": "Creation", "proposedBy": "Creator", "acceptedAt": 1788000000, "evidence": { "signature": "…" } }, { "version": 2, "definitionHash": "…", "changeType": "OutcomeAdd", "proposedBy": "Creator", "acceptedAt": 1788001000, "appliedAt": 1788001100, "evidence": { "signature": "…" }, "outcomePubkeysAdded": ["…"] }, { "version": 3, "definitionHash": "9f2a…", "changeType": "RulesEdit", "proposedBy": "Resolver", "rationale": "Clarified tie handling", "acceptedAt": 1788500000 } ], "onChain": { "state": "Live", "numOutcomes": 3, "outcomePubkeys": ["…", "…", "…"], "outcomeSetHash": "c41d…", "authorities": { "resolverAuthority": "…", "proposerAuthority": "…" }, "programId": "…" } }

changeType is one of Creation, TitleDescription, OutcomeLabel, OutcomeAdd, EndDate, TimingPolicy, RulesEdit, AuthorityChange. proposedBy is one of Creator, Resolver, Melee. evidence is absent on versions you created yourself (your request is the evidence) and on Melee-initiated versions.

Last updated on