Skip to content
On this page

Resolution grammar

OC Pledge ships seven resolution mechanisms. Six are deterministic functions of public state plus the pledge envelope; counterparty_signs needs the counterparty's signature. New mechanisms are added only with working integrator code demonstrating real demand — same discipline orangecheck applies to identity bindings.

The canonical DSL for each mechanism is normative; conforming implementations must produce byte-identical outcome envelopes for byte-identical inputs. Full grammar in SPEC §3.4 (opens in a new tab).

chain_stateLink to this section

Queries over Bitcoin chain state. Grammar limited to a small DSL:

Code
block(<N>).hash.startsWith(<hex>)
block(<N>).exists
tx(<txid>).confirmed
tx(<txid>).confirmations >= <N>
address(<addr>).balance >= <sats>
address(<addr>).utxo_count == <N>

Implementations execute against any public Bitcoin RPC; outputs must be byte-identical across implementations for the same chain state.

counterparty_signsLink to this section

Resolution requires a BIP-322 signature from the named counterparty over an outcome envelope. If the counterparty does not sign within expires_at, the pledge resolves to expired_unresolved — counted as a distinct third outcome class, neither kept nor broken.

nostr_event_existsLink to this section

Code
kind=<N> author=<npub_or_hex> tag(<name>)=<value> created_at_before=<ISO 8601 UTC>

Implementations query ≥ 2 relays from the default set; an event is considered to exist if any relay returns it and it validates. It is considered absent only when the read floor of the relays asked (four of five) answered in full with none cut off; otherwise the outcome is unchecked (SPEC §11 item 15).

stamp_publishedLink to this section

Looks up an OC Stamp envelope by content hash and signer:

Code
stamp(content_hash=sha256:<hex>, signer=<addr>)

The verifier consults the OC Stamp directory (Nostr kind-30083 under the oc-stamp:* d-tag namespace) and validates each matching envelope. The pledge is kept if at least one is authentic and its signed_at is before the pledge's resolves_at. No matching stamp counts only at the same read floor (SPEC §11 item 15). This is the canonical way to pledge "I will publish X by time T."

http_get_hashLink to this section

Fetches a URL, compares SHA-256 of the response body to an expected value:

Code
GET <https-url> body_sha256 == <64-hex>

Implementations follow at most 5 redirects, stop after 30 seconds in total, send User-Agent: oc-pledge/0.1, and verify TLS. Disagreements on transient network conditions are not protocol bugs: a contested result goes to the majority across at least three independent verifications (SPEC §3.4.5).

dns_recordLink to this section

Code
<TYPE> <name> == <value>

TYPE is one of A, AAAA, TXT, CAA, MX, CNAME. The query runs over DNS-over-HTTPS against at least two of the resolvers the spec names (Cloudflare, Google, Quad9). The record matches only if every queried resolver returns <value> byte for byte.

vote_resolvesLink to this section

Resolution delegated to an OC Vote poll whose id is named in the pledge. kept if the poll resolves above a specified threshold for a specified option, broken otherwise. See OC Vote for poll semantics.

What's NOT in the grammarLink to this section

Read this list twice. These mechanisms were proposed during design and explicitly rejected:

  • self_proof — a free-text "trust me" proof. Refused on protocol-correctness grounds: a pledge whose truth can't be checked from public state is not a pledge, it's a claim.
  • arbiter_decides — an unconstrained third-party judgment. Use vote_resolves for group judgment, or counterparty_signs with the adjudicator as the counterparty.
  • oracle_feed — a price, weather or score feed makes the oracle a trust anchor without naming it. Use http_get_hash against a specific endpoint, which names the oracle.
  • kleros_court — embeds a specific token-economy arbitration system. Use vote_resolves.
  • escrow_release — requires custody, which the protocol refuses.

The full rejection log: WHY and the REGISTRY (opens in a new tab).