Ethereum
Ethereum
eth_getProof
The eth_getProof method returns the account and storage values of a specific address, including cryptographic Merkle proofs. These proofs verify that the data is correctly included in the state trie without requiring trust in the data provider.
Use Cases
- L2 solutions that require state verification
- Cross-chain bridges and validation
- Trustless blockchain data verification
- Light client implementations
- Stateless client development
- Zero-knowledge proof systems
- Fraud proof construction
- Security audits and verification
Method Details
This method retrieves both account proofs and storage proofs for specified storage keys.
Response Example
Understanding Merkle Proofs
A Merkle proof allows verification that a piece of data is part of a Merkle tree without having the entire tree. In Ethereum:
- The state trie root is a 32-byte hash stored in each block
- Account data is stored in the state trie, with the account address as the key
- Account storage is stored in a separate storage trie, with the storage key as the key
- Proofs consist of a set of nodes that allow verification from the root hash to the target data
Practical Example
Finding Storage Slots
For Solidity contracts, storage slots can be determined as follows:
- Simple variables: Stored sequentially starting from slot 0
- Mappings:
keccak256(abi.encode(key, slot))whereslotis the position of the mapping declaration - Dynamic arrays:
keccak256(slot) + index - ERC20 balances: Usually in a mapping, e.g.,
keccak256(abi.encode(userAddress, 3))
See also
- eth_getStorageAt - Access raw storage values at specific positions in contracts
- eth_getCode - Get the deployed bytecode of a smart contract
Parameters
The address of the account to get proofs for
Array of storage keys to generate proofs for (JSON)
Block number or block tag