Verification
Given a signed attestation envelope, a verifier runs six deterministic steps. Any correctly-implemented verifier produces byte-identical codes and metrics for the same inputs — this is proven on every CI run against the conformance vectors.
StepsLink to this section
1. Parse the canonical messageLink to this section
Reject with decode_error if:
- Header literal isn't exactly
orangecheck(ororangecheck-authfor the challenge flow) - A required field is missing (
address,nonce,issued_at,ack,identities) - Line endings aren't LF with exactly one trailing newline
- Extensions (lines after the seven core lines, so after
ack) aren't lexicographically sorted by name - Any identifier in
identities:contains a comma, newline, or CR - Any key appears twice
Read the address, identities, issued_at and expires from this message. In an
envelope only message and signature are signed; its address, identities,
issued_at and expires_at are copies, so a verifier never uses, sorts by or
returns them. An expires: value that is not an RFC 3339 time is rejected as
expired, an issued_at that is not one as decode_error, and an issued_at
more than two minutes ahead of the verifier's clock as not_yet_valid.
2. Verify the BIP-322 signatureLink to this section
Against the declared address, using BIP-322. The
signature's bytes decide the scheme: a 65-byte signature is a legacy
signmessage (BIP-137) one, accepted on any address type, and anything else is
BIP-322 simple, with or without smp. Reject with sig_invalid if the
signature doesn't verify, and with sig_unsupported_script if it is a BIP-322
full or proof-of-funds signature (ful, pof).
3. Verify the attestation IDLink to this section
Compute sha256(canonical_message_bytes). If the caller supplied an
attestation_id, reject with invalid_attestation_id if it doesn't match the
computed hash. If the caller didn't supply one, the computed hash becomes the
attestation_id.
4. Fetch UTXOs for the addressLink to this section
Query a Bitcoin block explorer (mempool.space, blockstream.info, or your own Esplora endpoint). Fetch the current unspent-outputs list. The reference SDKs retry across multiple explorers if the primary times out.
5. Compute metricsLink to this section
sats_bonded— sum of confirmed UTXO values, unless the canonical message's extensions block includesbond: <integer>, in which case use exactly that value. A bond above the confirmed balance fails withbond_insufficient, and abond:value that is not a valid integer fails withbond_malformed; both setok: false.days_unspent— without abond:line, floor((now - earliest_confirm_time) / 86400) over the confirmed UTXOs. With abond:line, or when the caller asks for an amount (check()withmin_sats), the confirmed UTXOs are taken oldest first until they cover that amount, and the age is that of the youngest UTXO in the set.score—score_v0applied to the two values above.
Emit bond_confirmed if metrics computed cleanly, or bond_zero /
bond_pending / bond_insufficient as appropriate.
6. Apply policy thresholdsLink to this section
A lookup by id, address or identity reads every event a relay holds under the
subject's tag, paging past the relay's limit (the SDK reads up to 2,000 per
relay), since anyone can publish under those tags. When it finds several
attestations, the one checked is the newest by the issued_at its message
signs, skipping any dated more than two minutes ahead of the verifier's clock,
and the first of those whose signature verifies (OC Attest SPEC §7.2). Each
event is verified under NIP-01 before the relays' answers are merged, and copies
are never collapsed by attestation_id first: it leaves the signature out, so a
newer copy can carry a junk one (§6.1 rule 4).
If the caller passed min_sats and/or min_days, compare them against the
computed metrics. Add below_min_sats / below_min_days to the codes list on
failure.
Final ok is true iff the signature verifies, the bond is confirmed
(bond_confirmed) AND all thresholds are met. bond_zero (no confirmed
UTXOs, with bond_pending added when unconfirmed ones exist) sets ok: false,
as do bond_insufficient and bond_malformed.
Output shapeLink to this section
{
"ok": true,
"codes": ["sig_ok_bip322", "bond_confirmed"],
"attestation_id": "a3f5b8c2...",
"identities": [{ "protocol": "github", "identifier": "alice" }],
"metrics": {
"sats_bonded": 125000,
"days_unspent": 47,
"score": 30.12
},
"network": "mainnet"
}
On failure, ok: false with reasons (for /api/check) or just a fuller
codes list (for /api/verify). See the
status & error codes reference.
Offline vs. onlineLink to this section
Steps 1–3 are pure cryptographic work: parsing, hashing, signature
verification. An air-gapped machine with @orangecheck/bip322 (or the Python
equivalent) and nothing else can perform them.
Steps 4–6 need live chain state. A verifier that can reach any Esplora-compatible endpoint (public or private) can do them. Steps 4–6 produce metrics; step 3 produces the authority.
This separation means a signed proof is permanently verifiable — you can always re-check it against whatever chain state is current. Proofs don't go stale except when the signer spends the bonded UTXOs.
CachingLink to this section
/api/check(hosted) caches verification outcomes for 60 seconds. Bond state changes at Bitcoin's block cadence — 60 s of staleness is well below the block time and well above the noise floor./api/verify(raw verification) returnsno-store. It's the primitive caches should build on, not the other way around.- Clients SHOULD treat metrics as fresh for ~60 s for UX but MUST NOT persist them as authoritative ground truth — always re-verify before any decision that's material.
See alsoLink to this section
- Canonical message format — what step 1 parses
- BIP-322 signing — what step 2 verifies
- Conformance vectors — how we prove the algorithm is deterministic across impls
- Security — threats to the verifier — wrong-active-account, stale state, relay censorship