EIP-7545 Verkle proof verification precompile
No call decision · Scaling & data · EIP status Stagnant · created 2023-10-13
Adds a precompile at address 0x21 so smart contracts can verify, by version, the state proofs used in stateless Ethereum.
Why it is needed
To move toward a stateless approach where nodes no longer need to hold the full state, Ethereum intends to switch its proof scheme from the Merkle Patricia Trie (MPT) to multiproofs based on the Verkle tree. The proof format can still change flexibly from outside via a soft fork, but contracts that verify proofs directly on-chain, such as bridges, bear the burden of developing new verification logic and redeploying the contract every time the format changes. Shifting this burden from contracts to the precompile side means that when a new proof format appears, only the precompile needs to be upgraded while app contracts can stay as they are.
What changes
Today
- Each dApp or bridge contract must implement proof verification logic itself
- When the proof format changes from MPT to Verkle tree, related contracts must be redeveloped and redeployed
- The cost of maintaining compatibility is high for every app during the transition to statelessness
After EIP-7545
- A single precompile at address 0x21 verifies both MPT (version 0) and Verkle multiproofs (version 1) via a version field
- Apps only need to pass the proof and state_root to the precompile, and new proof formats can be handled by adding a version on the precompile side
- Verification result is returned simply as 1 for success, 0 for failure
Who is affected
- dApp and bridge developers: Instead of their own proof verification logic, they can substitute a call to the 0x21 precompile, reducing the redeployment burden when formats change
- Client teams: The precompile itself needs to be implemented, and the gas constants POINT_COST and POLY_EVAL_COST, still TBD, need to be finalized
- Statelessness transition researchers: During the soft-fork phase of moving from MPT to Verkle tree proofs, this precompile acts as a compatibility layer
In depth
Precompile address and input format
A precompile is added at address 0x21. The input is a byte string packing version (1 byte), state_root (32 bytes), and proof_data (variable length) in sequence. version specifies which stateless proof verification function to use.
Per-version verification logic
version 0 is MPT (Merkle Patricia Trie) based verification, which assumes proof_data follows the SSZ format described in the 'the verge' proposal. version 1 verifies polynomial commitment scheme (PCS) multiproofs as used in EIP-6800. In both cases the proof is parsed with deserialize_proof, then verify_mpt_multiproof or verify_pcs_multiproof is called respectively. An undefined version returns 0.
Return value
The precompile returns 1 if the proof could be verified, 0 otherwise. This is a simple interface that only communicates success or failure as a single boolean-like value.
Gas cost formula
Cost is defined as cost = (POINT_COST + 1) * len(get_commitments(input)) + POLY_EVAL_COST * sum(leaf_depth(key, tree) for key in keys). get_commitments gets the list of commitments contained in the proof, get_keys gets the list of keys being proven, and leaf_depth gets the depth of that leaf in the tree. However, both the POINT_COST and POLY_EVAL_COST constants are still TBD and not finalized.
Design intent: format flexibility and separation of responsibility
Proofs for stateless Ethereum span a rapidly evolving area of cryptography, so the current approach is a soft-fork one that allows the proof format to be changed flexibly outside the consensus layer. Because of this, applications like bridges bear the burden of having to support new proof formats introduced after deployment, but delegating verification to a version-aware precompile allows new proof methods to be supported without changing the application contract.
Incomplete state and open issues
This EIP's status is Stagnant. Test Cases is left as a TODO and empty, Reference Implementation has only a WIP (Optimism's op-geth PR #192), and the Security Considerations section is marked 'Needs discussion' and has not yet been discussed. The gas constants (POINT_COST, POLY_EVAL_COST) are also still TBD and undetermined, so further discussion and finalized figures are needed before actual adoption.