eth_getProof - Scroll
Example code for the eth_getProof JSON-RPC method. Complete guide on how to use eth_getProof JSON-RPC in GetBlock Web3 documentation.
This method returns the account and storage Merkle-Patricia proofs for an address at a given block. It is used to verify account state against a block's state root without trusting the node.
Parameters
address
string
Yes
20-byte account address
storageKeys
array
Yes
Array of 32-byte storage slot keys to prove
blockParameter
string
Yes
Block number in hex, or "latest", "earliest", "pending"
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getProof",
"params": ["0x4200000000000000000000000000000000000006", ["0x0000000000000000000000000000000000000000000000000000000000000000"], "latest"],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'eth_getProof',
params: ['0x4200000000000000000000000000000000000006', ['0x0000000000000000000000000000000000000000000000000000000000000000'], 'latest'],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'eth_getProof',
'params': ['0x4200000000000000000000000000000000000006', ['0x0000000000000000000000000000000000000000000000000000000000000000'], 'latest'],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"address": "0x4200000000000000000000000000000000000006",
"balance": "0x0",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"nonce": "0x1",
"storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"accountProof": [
"0xf90211a0..."
],
"storageProof": [
{
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0",
"proof": [
"0xf90211a0..."
]
}
]
}
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
object
Account fields plus account and storage proofs (see fields below)
Result Object
balance
string
Account balance in wei (hex)
codeHash
string
Keccak-256 hash of the account code
nonce
string
Account nonce (hex)
storageHash
string
Root hash of the account storage trie
accountProof
array
RLP-encoded Merkle-Patricia nodes proving the account
storageProof
array
Per-key proofs with key, value, and node list
Use Cases
Trustless Verification: Verify account state against a known state root
Light Clients: Prove balances and storage without full state
Cross-Chain Bridges: Feed storage proofs into a verifier contract
Audit Evidence: Produce a cryptographic proof of a slot value at a block
Error Handling
-32602
Invalid params
Malformed address, storage key list, or block parameter
-32603
Internal error
The node failed to build the proof
Web3 Integration
Last updated
Was this helpful?