eth_getProof - Pharos

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

ParameterTypeRequiredDescription
addressstringYes20-byte account address
storageKeysarrayYesArray of 32-byte storage slot keys to prove
blockParameterstringYesBlock number in hex, or "latest", "earliest", "pending"

Request

bashcurl --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": ["0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b", ["0x0000000000000000000000000000000000000000000000000000000000000000"], "latest"],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_getProof',
    params: ['0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b', ['0x0000000000000000000000000000000000000000000000000000000000000000'], 'latest'],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport 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': ['0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b', ['0x0000000000000000000000000000000000000000000000000000000000000000'], 'latest'],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "eth_getProof",
            "params": ["0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b", ["0x0000000000000000000000000000000000000000000000000000000000000000"], "latest"],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "address": "0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b",
        "balance": "0x0",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "nonce": "0x1",
        "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "accountProof": [
            "0xf90211a0..."
        ],
        "storageProof": [
            {
                "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "value": "0x0",
                "proof": [
                    "0xf90211a0..."
                ]
            }
        ]
    }
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultobjectAccount fields plus account and storage proofs (see fields below)

Result Object

FieldTypeDescription
balancestringAccount balance in wei (hex)
codeHashstringKeccak-256 hash of the account code
noncestringAccount nonce (hex)
storageHashstringRoot hash of the account storage trie
accountProofarrayRLP-encoded Merkle-Patricia nodes proving the account
storageProofarrayPer-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

Error CodeMessageDescription
-32602Invalid paramsMalformed address, storage key list, or block parameter
-32603Internal errorThe node failed to build the proof

Web3 Integration

ethers-example.js

javascriptimport { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

const proof = await provider.send('eth_getProof', ['0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b', ['0x00...00'], 'latest']);

viem-example.js

javascriptimport { createPublicClient, http } from 'viem';

const client = createPublicClient({
  transport: http('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/')
});

const proof = await client.getProof({ address: '0x7e5f1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b', storageKeys: ['0x00...00'] });