Expand description
Deterministic HTTP oracle commit-reveal consensus.
Architecture - three-phase per-block oracle protocol:
PHASE 1 (fetch): Each validator independently fetches URLs that Axiom cells requested during the previous block’s execution. Requests are collected into OracleRequest records and written to pending_oracle_requests on State.
PHASE 2 (commit): Before proposing a block, each validator broadcasts SubmitOracleCommit transactions: commit_hash = blake3(validator_pk || request_id || response_body) These land on-chain as OracleCommit records.
PHASE 3 (reveal): Once >= ORACLE_QUORUM_PERCENT of stake has committed, validators broadcast SubmitOracleReveal transactions carrying the raw response_body. The chain verifies blake3(validator_pk || request_id || revealed_body) == commit_hash and adds the validator’s response to the tally. When quorum of IDENTICAL reveals is reached, the canonical response is written to OracleResult on State. Axiom cells can then read it synchronously in the next block.
Non-determinism is eliminated because:
- Axiom cells never call the network directly.
http_callreads OracleResult. - Every validator signs their reveal with their validator key.
- Divergent responses fail to reach quorum and produce no result.
- Results are content-addressed by request_id (blake3 of url+method+body).
- Results expire after gp::get_u64(gp::PARAM_ORACLE_CACHE_EXPIRY_BLOCKS) and are refetched.
URL governance - public cells:
- Anyone may propose a URL pattern with a bond via the oracle governance system cell.
- Validators vote; 2/3 stake approval passes.
- Owner may report malicious URL; 70% of bond slashed.
- Private cells (SetCellVisibility = Private) bypass governance.
Modules§
- return_
codes - Return codes from the
http_callhost function. - storage_
keys
Structs§
- Oracle
Commit - A validator’s commit to a specific oracle request response. Written to State by SubmitOracleCommit transaction.
- Oracle
Commit Payload - Payload produced by validator_fetch_and_commit - passed as SubmitOracleCommit.
- Oracle
Request - An Axiom cell requested an HTTP fetch. Stored in State::pending_oracle_requests.
- Oracle
Result - The finalized oracle result after quorum of identical reveals. Axiom cells read from this committed result, never from live HTTP.
- Oracle
Reveal - A validator’s reveal of their committed oracle response. Written to State by SubmitOracleReveal transaction.
- Oracle
Tally - Pending tally for a single oracle request - accumulates commits and reveals as validators submit them. Lives in State::oracle_pending.
Functions§
- check_
url_ permitted - Check if a URL is permitted for the given cell visibility. Private cells: any URL. Public cells: URL must match an approved pattern.
- compute_
commit_ hash - Commit hash: validator commits to their response without revealing it. commit_hash = blake3(“oracle:commit:” || validator_pk || request_id || response_body)
- queue_
oracle_ request - Queue an oracle request from an Axiom host call. Called by the
http_callhost function when no finalized result is available. The request is added to State::pending_oracle_requests so validators fetch it next block. - request_
id - Canonical identifier for an oracle request. Derived deterministically from (url, method, body) - same request across validators yields the same request_id with no coordination needed.
- url_
matches_ pattern - Check if URL matches an approved pattern (prefix match with wildcard).
- url_
response_ format - Resolve a public URL’s response format from the approved proposal.
- url_
schema_ id - validator_
fetch_ and_ commit - Fetch all pending oracle requests and produce commit transactions. validators call this after the previous block finalizes.