Draft ERC: Cryptographic Proof Attachment Standard

Hello everyone,

I am proposing ERC-XXXX (Cryptographic Proof Attachment Standard) — a minimal, vendor-neutral on-chain interface (IERCXXXX) for attaching cryptographic proof artifacts to arbitrary bytes32 assets and composing them into bounded dependency DAGs.

Motivation

Attestation standards (EAS, Verax, Sign Protocol) model who said what about whom, while cross-chain messaging/storage-proof standards (such as ERC-7888) focus on remote state-slot verification. Neither defines a shared local ABI for:

  • binding a fixed-shape off-chain proof commitment (proofHash) to an arbitrary domain-separated assetId,
  • expressing bounded proof-to-proof dependencies (MAX_DEPENDENCIES = 16, with strict on-chain existence and direct self-reference checks),
  • exposing a minimal reserved verification/dispute flag bitfield (FLAG_FLAGGED, FLAG_VERIFIED) consumable by generic wallets, indexers, and explorers without per-schema logic,
  • accepting either compact pointers (IPFS/Arweave/attestation UIDs) or inline proof payloads (MPT / ZK proofs up to an immutable per-implementation MAX_METADATA_LEN()) without forcing full-payload SSTORE.

Key Design Choices

  • Minimal 7-function interface (IERCXXXX, ERC-165 ID 0x7118c651, CC0-1.0): attachProof, setProofFlags, getProof, getAssetProofs, proofExists, getProofCount, MAX_METADATA_LEN.
  • B-hybrid metadata layout: attachProof accepts full metadata calldata (capped by an immutable MAX_METADATA_LEN() in [256, 65535]) and emits the full bytes in ProofAttached, while getProof persists and returns only metadataHash, a word-aligned metadataHead (0 / 32 / 64 / 96 bytes), and uint16 metadataLen.
  • Pure DAG invariant: every dependencies[i] MUST satisfy proofExists(dependencies[i]) == true. Larger dependency sets (> 16) compose by attaching a normal Merkle-root proof (proofHash == merkleRoot) and referencing its proofId as a single dependency.
  • Deterministic proofId: recommended preimage (block.chainid, address(this), assetId, proofHash, submitter, attachNonce) excludes metadata, block.timestamp, and block.number, making proofId precomputable off-chain and direct self-reference checks exact.
  • Reference implementation (MIT, Foundry): ProofRegistry (~4.4 KB), optional ProofRegistryMerkle extension, NFTAuthenticity worked example, all 9 mandatory compliance tests, fuzz suite, and gas snapshot benchmarks.

Links

Feedback from EIP editors, rollup/indexer teams, and application builders is very welcome — especially on the B-hybrid metadataHead word-alignment rule, the immutable MAX_METADATA_LEN() bounds, and reserved flag semantics.

ERC draft PR is now open on ethereum/ERCs (CI / EIPW passing): Add ERC: Cryptographic Proof Attachment by nidhal-ferjani · Pull Request #2238 · ethereum/ERCs · GitHub

@nidhal-ferjani attachNonce in the reference is the asset’s proof count, and anyone can attach to any assetId, so an id computed off-chain holds only if nobody else attaches to that asset first. If another attach lands earlier in the block, the first call gets a different proofId and a second call listing the precomputed one as a dependency reverts with DependencyMissing, which is the same-block case the Rationale says has to work. A counter per submitter, or per assetId and submitter, keeps the id in the submitter’s hands.

In ProofRegistry anyone can set FLAG_FLAGGED and only the owner can clear it, and the bitfield doesn’t record who set it. One address can mark every proof in the registry as disputed for the cost of gas, and a wallet reading getProof can’t tell that apart from a verifier’s dispute. The spec limits clearing the bit but not setting it, so FLAGGED can mean different things across implementations, the problem the Authorization section sets out to prevent. And since setProofFlags takes the whole value, a flag landing just before a verifier’s setProofFlags(id, FLAG_VERIFIED) makes that call revert, because it would now clear FLAGGED. Separate set and clear masks would avoid that.

1 Like

@Zealynx good catches—all three are real issues in the current draft and reference registry.

On the nonce, you’re right that sharing the per-asset count breaks same-block precomputation in an open registry if someone else attaches first. Moving the recommended nonce to a per-`(assetId, submitter)` counter fixes that without hurting uniqueness.

On flags, leaving `FLAG_FLAGGED` open at zero cost in `ProofRegistry` is a griefing vector and doesn’t match what `Authorization` is trying to guarantee. I’m going to separate flagging/dispute initiation from verification in the reference implementation and tighten the spec around who can raise `FLAG_FLAGGED` as well as clear it. Moving `setProofFlags` to `(setMask, clearMask)` (reverting on overlapping bits) also makes a lot of sense to avoid the verifier/flag race.

I’m also looking at how the spec should handle unsupported bits in `2..255` (default revert vs extension hooks) before locking the new signature and updating PR #2238.