Verify an Ethereum storage value against a trusted state root
A storage proof is useful when a service needs to check an RPC response independently. Verification has two stages because each account has its own storage trie.
Anchor the account before checking the slot
Obtain a trusted block header and its state root. Request eth_getProof for the contract, the desired 32-byte slot key and that block number. Use an Ethereum Merkle Patricia trie verifier to check the account path keyed by Keccak-256 of the raw address.
trusted stateRoot → verified account → storageRoot → verified slot
Decode the proven account to obtain its storage root. Verify the storage proof against that root using the hash of the 32-byte slot key, then decode the proven slot value. Compare it to the separately reported value only after both paths validate.
Test absence and mismatched blocks
Include a known empty slot in tests: a valid absence proof can establish zero storage without a value leaf. Reusing a proof with the wrong state root must fail whenever the relevant authentication path differs. A header supplied solely by the same untrusted RPC leaves the trust anchor unresolved. eips.ethereum.org eth_getProof / EIP-1186