ERC-8281: Observation Commitment Protocol
Defines a proof envelope and verification invariant for independently confirming that a specific byte sequence was committed on-chain.
Abstract
This ERC defines a minimal proof envelope format, an extraction rule for retrieving committed digests from raw Ethereum Virtual Machine (EVM) ledger data, and a verification invariant: recompute → compare → confirm inclusion.
A conforming verifier confirms that a specific byte sequence was committed on-chain at a given point in time using raw transaction receipt data obtained from a remote procedure call (RPC) endpoint or local node. No trusted software development kit (SDK), gateway, or indexer is required, though verifiers are advised to cross-check multiple independent endpoints to avoid trusting any single RPC provider.
This ERC is scoped to EVM-compatible chains.
Motivation
Ethereum does not define a standard procedure for a third party to confirm that a specific byte sequence was committed on-chain, independent of the system that produced the commitment.
In practice, each implementation defines its own encoding of observed data, its own proof artifact structure, its own transaction reference format, and its own verification logic. Proofs produced by one system are not independently verifiable by another without custom integration.
The gap is not access to data or correctness of execution. The gap is the absence of a shared verification boundary — a minimal, portable procedure that any third party can follow to confirm a commitment without trusting the originating system.
This ERC defines that boundary.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Contract Interface
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
interface IObservationCommitment {
/// @notice Commit a digest on-chain.
/// @param digest The hash of the observation bytes, produced using
/// a hash function from the allowed set defined in this ERC.
function record(bytes32 digest) external;
/// @notice Emitted on every successful record() call.
/// @param digest The committed digest (topics[1]).
/// @param committer The address that called record() (topics[2]).
event Recorded(
bytes32 indexed digest,
address indexed committer
);
}
The canonical event signature is Recorded(bytes32,address).
The canonical event topic-0 is:
keccak256("Recorded(bytes32,address)") = 0xdca60c2087041cbb12d9a57628c6cad28ecbd0437e47c7ab6c3aa6e162bf4497
Implementations SHOULD support ERC-165 with the IObservationCommitment interface ID to enable on-chain discoverability. Because the interface contains a single function, the interface ID is the selector of record(bytes32):
bytes4(keccak256("record(bytes32)")) = 0xb5c645bd
ERC-165 support enables on-chain discovery of contracts that claim support for IObservationCommitment. It does not by itself establish behavioral conformance; whether to trust or validate the emitting contract is a decision for the relying party.
Note on delegatecall and proxies: Logs emitted via delegatecall carry the proxy contract's address in the log's
addressfield. Thecontractfield in the proof envelope MUST match the emitting address exactly as recorded in the receipt log — not the implementation address.
Hash Function Registry
The hash_function field in the proof envelope MUST be drawn from the following allowed set. Identifiers follow the Multihash naming convention, lowercase, hyphen-separated.
| Identifier | Algorithm | Output bits | Notes |
|---|---|---|---|
sha2-256 | SHA-256 | 256 | RECOMMENDED default |
keccak-256 | Keccak-256 | 256 | EVM-native |
blake2b-256 | BLAKE2b | 256 | BLAKE2b with 256-bit digest parameter (NOT truncated BLAKE2b-512) |
All identifiers are case-sensitive lowercase. Verifiers MUST reject envelopes declaring a hash_function not present in this table.
All allowed hash functions natively produce 256-bit (32-byte) output, matching the bytes32 parameter of record(). The digest MUST be the complete output of the declared hash function; it MUST NOT be truncated or padded. In particular, blake2b-256 denotes BLAKE2b initialized with a 256-bit digest-length parameter; this produces a different digest than truncating BLAKE2b-512 output to 32 bytes, and only the parameterized form is conformant.
This registry is closed for the lifetime of this ERC. Additions to the allowed set require a successor ERC. All functions in this registry provide at least 128 bits of collision resistance.
Proof Envelope Schema
A proof envelope is a JavaScript Object Notation (JSON) object. The following fields are all REQUIRED. Additional fields not listed here MUST be ignored by verifiers.
{
"version": "erc8281/1",
"digest": "<0x-prefixed lowercase hex-encoded bytes32>",
"hash_function": "<identifier from Hash Function Registry>",
"chain_id": "<EIP-155 chain ID as decimal string, no leading zeros>",
"contract": "<EIP-55 checksummed EVM address>",
"tx_hash": "<0x-prefixed lowercase hex-encoded transaction hash>",
"block_number": "<decimal block number, no leading zeros>",
"receipt_log_position": "<decimal zero-indexed position of the matching log within the receipt's log array, no leading zeros>",
"committer": "<EIP-55 checksummed EVM address>"
}
Field normalization rules:
-
digest: MUST be 0x-prefixed, 66 characters total, lowercase hex. Comparisons MUST be performed over the decoded 32-byte value, not the string. -
chain_id: MUST be a decimal integer string with no leading zeros. Comparisons MUST be performed over the decoded integer value. -
contract: MUST be checksummed per ERC-55. Verifiers MUST reject envelopes containing addresses that fail ERC-55 checksum validation. Address comparisons MUST be performed over the decoded 20-byte value. -
tx_hash: MUST be 0x-prefixed, 66 characters total, lowercase hex. -
block_number: MUST be a decimal integer string with no leading zeros. -
receipt_log_position: MUST be a decimal integer string with no leading zeros. This field is the zero-indexed position of the matching log within the receipt'slogsarray. It uniquely identifies a single log entry within the receipt and is used to select exactly one log during extraction.Warning — this is NOT the JSON-RPC
logIndexfield. ThelogIndexfield returned by JSON-RPC on each log object is the log's position within the block, not within the receipt. Implementations MUST selectreceipt.logs[receipt_log_position]by array position and MUST NOT compare this field against the JSON-RPClogIndexvalue. -
committer: MUST be checksummed per ERC-55. Verifiers MUST reject envelopes containing addresses that fail ERC-55 checksum validation. Address comparisons MUST be performed over the decoded 20-byte value.
Optional fields:
{
"block_hash": "<0x-prefixed lowercase hex-encoded block hash>"
}
block_hash is OPTIONAL. It MUST be 0x-prefixed, 66 characters total, lowercase hex. When present, it is checked against the fetched receipt as the Extraction Rule requires. This provides a reorg-detection mechanism: if the transaction has migrated to a different block after a chain reorganization, the check fails.
Version semantics: The version string for this ERC is erc8281/1, compared by exact, case-sensitive string match. Verifiers MUST reject envelopes whose version value they do not implement. The version increments only on breaking changes to the envelope schema or verification procedure; non-breaking clarifications do not change the version. Any future breaking revision requires a successor ERC and a new version string.
Extraction Rule
Given a proof envelope, the extraction procedure is as follows. The JSON-RPC method eth_chainId and the receipt and log fields status, logs, blockHash, blockNumber, address, topics, data and logIndex are as defined in the Ethereum execution-apis specification.
- Fetch the transaction receipt for
tx_hashonchain_idvia an RPC endpoint or local node. Before using the endpoint, the verifier MUST confirm that it serves the declared chain: the endpoint'seth_chainIdMUST equal the envelope'schain_id(decoded integer comparison). If the chain IDs do not match, extraction fails. If the endpoint returns no receipt fortx_hash, extraction fails. The receipt MUST havestatus == 1(success). If the receipt has nostatusfield, as for transactions included before the Byzantium fork, extraction fails. A reverted transaction MUST NOT be treated as a valid commitment. - Select the log at array position
receipt_log_positionwithin the receipt'slogsarray (zero-indexed). If no log exists at that position, extraction fails. - Assert that the selected log's
addressfield matchescontract(decoded 20-byte comparison). - Assert that the selected log contains exactly three topics, and that
topics[0]matcheskeccak256("Recorded(bytes32,address)")=0xdca60c2087041cbb12d9a57628c6cad28ecbd0437e47c7ab6c3aa6e162bf4497. A log with fewer or more than three topics MUST be rejected, even iftopics[0]matches. The log'sdatafield is not used by this procedure and MUST be ignored. - Decode
topics[1]asbytes32. This is the on-chain digest,on_chain_digest. Becausedigestis an indexed parameter of fixed-size type,topics[1]contains the digest value verbatim — it is not hashed, unlike indexed parameters of dynamic types. - Decode
topics[2]asaddress(20 bytes, right-aligned in the 32-byte topic). This is the on-chain committer,on_chain_committer.
If block_hash is present in the envelope, the verifier MUST additionally assert that it equals the receipt's blockHash field (decoded 32-byte comparison).
Verification Invariant
A conforming verifier MUST execute the following procedure. The observation bytes are an input supplied to the verifier out-of-band — they are not encoded in the envelope. Verification is performed over exactly those bytes as provided.
- Recompute: Apply the
hash_functiondeclared in the envelope to the supplied observation bytes. ProduceH_prime. An envelope whosehash_functionis outside the Hash Function Registry is rejected, as that section requires. - Compare: Assert
H_prime == digest(decoded bytes comparison). - Confirm inclusion: Apply the extraction rule, including all assertions it contains. Assert
on_chain_digest == digest(decoded bytes comparison). - Confirm committer: Assert
on_chain_committer == committer(decoded address comparison). - Confirm block: Assert the receipt's
blockNumber == block_number(integer comparison).
If all assertions pass — including those internal to the extraction rule — the named contract emitted a Recorded log at the referenced block containing the digest of the supplied observation bytes and the declared committer value, independently of the system that produced the proof envelope. If the emitting contract is separately trusted or validated as conforming, the committer corresponds to the address that called record().
The digest is self-verifying. The committer is not. A verifier recomputes the digest from the observation bytes in their own possession — that step is independent of the emitting contract's behavior. The committer field is asserted by the contract; nothing in the verification procedure recomputes it. Receipt extraction establishes that the named contract logged this digest and committer value; whether committer equals the address that called record() is conditional on the emitting contract being separately trusted or validated as conforming.
If any assertion fails, the verification MUST be rejected. Partial verification — passing some assertions but not others — MUST NOT be treated as a valid commitment.
Authenticated vs. informational fields: The procedure above authenticates the following envelope fields: digest, hash_function, chain_id, contract, tx_hash, receipt_log_position, committer, block_number, and block_hash when present. chain_id and tx_hash are authenticated relative to the endpoint queried: the procedure relies on the endpoint's own eth_chainId answer and on the receipt it returns for tx_hash. The version field is checked for implementer support. No other semantic claims in the envelope are authenticated by this procedure. Relying parties MUST NOT treat a passing verification as an endorsement of any field or claim not listed here.
Out of Scope
This ERC does not define identity, authorship, sanitization, data availability, canonical encoding of observation content, or application-layer semantics. These are explicit non-goals. Systems building on this standard are responsible for the layers above this boundary.
This ERC does not define an extraction profile for non-EVM ledgers. Implementations on non-EVM chains are outside the scope of this standard and MUST NOT claim conformance with this ERC.
This ERC does not define linkage between successive commitments — supersession, amendment, or parent/successor ordering across multiple record() calls. A committed digest is a single-shot fact; sequencing and current-state interpretation are the responsibility of the layer that references it.
Rationale
The verification invariant is the smallest boundary that enables independent, system-agnostic verification of an on-chain commitment. The proof envelope bundles the committed digest and chain reference into a single portable artifact that travels independently of the infrastructure that produced it.
Relationship to other commitment standards: ERC-5732 standardizes a contract interface for submitting commitments in commit-reveal schemes; it defines the commit call and leaves reveal and verification to each application. ERC-8326 standardizes how a set of documents is reduced to a bundle hash and anchored per subject, with supersession history. This ERC addresses a different layer. It defines no content encoding and no application semantics; it specifies a portable proof envelope and the procedure by which a third party confirms, from raw receipt data, that a given digest was committed. The standards can be used together, since this ERC is indifferent to what the observation bytes represent.
Why receipt_log_position instead of any-match semantics: A single transaction may emit multiple Recorded events from the same contract. Any-match semantics — accepting verification if any matching log contains the digest — create ambiguity about which commitment is being verified and allow a prover to front-run a legitimate commitment with a malicious one in the same transaction. receipt_log_position uniquely identifies a single log entry and removes this ambiguity.
Why the field is named receipt_log_position rather than log_index: The JSON-RPC log object exposes a logIndex field that is block-scoped, not receipt-scoped. A field named log_index invites implementers to compare against the JSON-RPC value, which coincides with the receipt-array position only when no earlier transaction in the same block emitted a log. The name receipt_log_position makes the receipt-scoped semantics explicit.
Why the Recorded event carries no timestamp: Block timestamps are set by block producers within consensus rules and are derivable from block_number via any RPC endpoint. Storing a timestamp in the event would cost gas, create a false-authenticity surface (the contract could emit an arbitrary value), and be redundant. Block time is the authoritative timestamp; block_number is the reference.
Why hash_function is constrained to a registry: A free-form hash_function field allows a malicious prover to declare a weak hash function (e.g., MD5), present a colliding observation, and pass all verification assertions. Constraining to a named registry with a minimum security level (256-bit output, ≥128-bit collision resistance) closes this attack vector at the spec level.
Why the verifier must reject unrecognized identifiers: The registry constraint binds committers. A separate requirement that verifiers must reject unrecognized identifiers ensures that both sides of the protocol enforce the registry — a committer cannot declare a weak function and find a naive verifier that accepts it.
Why the registry is closed: A Final ERC is immutable, so "amending this ERC" is not an available extension mechanism. Making the registry explicitly closed, with additions delegated to a successor ERC, keeps the conformance target unambiguous for the lifetime of this document.
Why this ERC is EVM-scoped: The extraction rule depends on EVM transaction receipt structure, topics, and EIP-155 chain IDs. Extending to non-EVM chains requires a different extraction profile, which this ERC does not define.
The contract interface is minimal by design. record() takes a single bytes32 digest and emits a single Recorded event. The contract enforces no constraints on the digest content, the committer identity, or the observation semantics. These are the responsibility of the caller.
Backwards Compatibility
No backwards compatibility issues with the Ethereum protocol. This ERC introduces no changes to the protocol layer.
Test Cases
Test vectors are provided in test-vectors.json and are executed by the runner run_vectors.mjs against the reference verifier. The suite covers:
- Correct verification — SHA-256 observation, valid envelope, all assertions passing
- Correct verification — Keccak-256 observation, valid envelope
- Correct verification — BLAKE2b-256 (parameterized) observation, valid envelope; includes a negative companion vector confirming that truncated BLAKE2b-512 output does NOT verify
- Rejection — digest mismatch (
H_prime != digest) - Rejection — on-chain digest mismatch (digest not at declared
receipt_log_position) - Rejection — committer mismatch
- Rejection —
block_numbermismatch - Rejection — unrecognized
hash_functionidentifier - Rejection — receipt
status == 0(reverted transaction) - Rejection —
receipt_log_positionout of range - Rejection — contract address mismatch at
receipt_log_position - Rejection —
block_hashmismatch (optional field, when present) - Rejection — address failing ERC-55 checksum validation
- Constant verification — the topic-0 literal
0xdca60c2087041cbb12d9a57628c6cad28ecbd0437e47c7ab6c3aa6e162bf4497and the ERC-165 interface ID0xb5c645bdmatch values computed from the signature strings - Distinction vector — a receipt whose first log's JSON-RPC
logIndexdiffers from its receipt-array position, confirming implementations select by array position - Rejection — endpoint
eth_chainIddoes not match envelopechain_id(wrong-chain endpoint) - Rejection — log with matching
topics[0]but fewer than three topics (hand-crafted assembly log) - Rejection —
topics[0]belongs to a different event, with three topics - Rejection — log with matching
topics[0]but more than three topics - Rejection — receipt with two
Recordedlogs where the digest is at a position other thanreceipt_log_position, confirming that no any-match fallback is applied - Correct verification — non-empty log
datais ignored - Correct verification — an unknown additional envelope field is ignored
- Rejection —
versionvalue the verifier does not implement - Rejection —
versiondiffering only in letter case - Rejection —
digestin uppercase hex - Rejection —
chain_idwith a leading zero - Rejection —
tx_hashin uppercase hex - Rejection —
block_numberwith a leading zero - Rejection —
receipt_log_positionwith a leading zero - Rejection —
block_hashpresent but not 32 bytes - Rejection — no receipt returned for
tx_hash - Rejection — receipt with no
statusfield
Reference Implementation
A reference contract implementation (ObservationCommitment.sol), interface (IObservationCommitment.sol), and reference verifier (verify.mjs) are provided in the assets directory.
Security Considerations
Hash function allowlist: A prover who can choose the hash function can choose a weak one and present a colliding observation. The Hash Function Registry in the Specification closes this at the verifier level: verifiers reject any identifier outside the registry, regardless of what a committer declares.
Digest collision resistance: All hash functions in the allowed set provide at least 128 bits of collision resistance. The registry is closed, so this threshold holds for every envelope that conforms to this ERC.
Low-entropy observations: The commitment is binding but not hiding. A digest of a predictable document (a form, a vote, a price, a small integer) is a dictionary-attack target — the public digest leaks the content to anyone who can enumerate the observation space. Committers of low-entropy observations are advised to salt the observation before hashing and to retain the salt alongside the observation. The salt is then part of the observation bytes: verification is performed over exactly the bytes that were hashed, so the verifier needs the salted bytes.
Transaction receipt integrity: Receipt integrity is guaranteed by the chain's consensus mechanism. A verifier can independently verify the receipt against a block header using standard Merkle Patricia Trie proof techniques. Verifiers that do not perform header verification are trusting the RPC provider.
RPC trust: Querying a single eth_getTransactionReceipt endpoint trusts that endpoint to return honest data. Verifiers are advised to cross-check results across multiple independent RPC providers. Verifiers requiring stronger guarantees can verify the receipt against a block header obtained from a light client or other independent source.
Finality and reorgs: A commitment at a given block is only as final as that block. On proof-of-stake Ethereum, blocks reach economic finality after approximately two epochs (~12.8 minutes). On layer 2 (L2) networks, sequencer-confirmed blocks may not yet be settled to layer 1 (L1). Verifiers are advised to require finalized blocks or a confirmation depth appropriate to the chain and the value at risk. The optional block_hash field provides a reorg-detection mechanism — when present, a receipt that has migrated to a different block fails verification.
Contract trust: Verification establishes that the named contract emitted a Recorded event with the declared digest. It does not establish that the contract is a conforming deployment of this ERC or that the committer had any particular authorization. Any contract — conforming or not — can emit an event with the canonical signature. Whether to trust the contract address is a decision for the relying party — for example, by reviewing the deployed code or by consulting a known registry of conforming deployments. ERC-165 support for interface ID 0xb5c645bd indicates only that a contract claims the interface.
Committer address does not imply authorship: The committer field identifies the address that called record() — this relationship follows from conforming contract behavior, but is not established by receipt extraction alone (see Contract trust above). It does not imply that the committer authored the observation, holds any identity claim, or had any authority over the observed data. Identity binding is the responsibility of higher-layer protocols.
No revocation: This ERC does not define a revocation mechanism. A committed digest cannot be un-committed. Systems requiring revocation need to implement it at the application layer.
Timestamp precision: The time of a commitment is the timestamp of the block identified by block_number, as set by that chain's block producer under its consensus rules. Its precision depends on the chain. On Ethereum mainnet since the Merge, timestamps follow 12-second slots. Other EVM-compatible chains have different block intervals and timestamp rules — on some, consecutive blocks can share a timestamp — so applications are advised to treat block timestamps as approximate and to use block_number to order commitments on the same chain.
Copyright
Copyright and related rights waived via CC0.