eth_getProof - Mantle

This method returns the account and storage values of the specified account including the Merkle proof. This is useful for verifying state without trusting the RPC provider.

Parameters

ParameterTypeDescription
addressstringThe address of the account
storageKeysarrayArray of storage keys to prove
blockNumberstringBlock number (hex) or tag

Request

curl

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

example.js

javascriptimport axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_getProof",
    "params": [
        "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE",
        ["0x0"],
        "latest"
    ],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));

example.py

pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
    "jsonrpc": "2.0",
    "method": "eth_getProof",
    "params": [
        "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE",
        ["0x0"],
        "latest"
    ],
    "id": "getblock.io"
})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)

main.rs

rustuse reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
            "jsonrpc": "2.0",
            "method": "eth_getProof",
            "params": [
                "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE",
                ["0x0"],
                "latest"
            ],
            "id": "getblock.io"
        }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}

ethers.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', [
    '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE',
    ['0x0'],
    'latest'
]);
console.log('Proof:', proof);

viem.js

javascriptimport { createPublicClient, http } from 'viem';
import { mantle } from 'viem/chains';

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

const proof = await client.getProof({
    address: '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE',
    storageKeys: ['0x0']
});
console.log('Proof:', proof);

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "address": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae",
        "accountProof": ["0xf90211a0..."],
        "balance": "0x0",
        "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "nonce": "0x0",
        "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "storageProof": []
    }
}

Response Parameters

FieldTypeDescription
addressstringThe address of the account
accountProofarrayArray of RLP-serialized Merkle proof nodes
balancestringAccount balance in wei (hex)
codeHashstringHash of the account code
noncestringAccount nonce (hex)
storageHashstringStorage root hash
storageProofarrayArray of storage proofs

Use Case

The eth_getProof method is essential for:

  • Light client verification
  • Trustless state validation
  • Cross-chain bridges
  • State proof verification
  • Decentralized applications requiring proof

Error Handling

Status CodeError MessageCause
403ForbiddenMissing or invalid ACCESS-TOKEN
-32602Invalid paramsInvalid address or storage keys

Web3 Integration

javascriptimport { ethers } from "ethers";
const RPC_URL = "https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>";
const provider = new ethers.JsonRpcProvider(RPC_URL);
async function fetchBlockNumberFromProvider() {
  try {
    // Call the method — this will resolve to a number (promise resolves to number)
     const result = await provider.send("eth_getProof", [
        "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE",
        ["0x0"],
        "latest"
    ],);
    console.log("Block number result:", result);
    return result;
  } catch (error) {
    console.error("Ethers Error fetching block number:", error);
    throw error;
  }
}
jsximport { createPublicClient, http } from "viem";
import { hyperEvm } from "viem/chains";

// Create Viem client with GetBlock
const client = createPublicClient({
  chain: hyperEvm,
  transport: http(import.meta.env.MANTLE_ACCESS_TOKEN),
});

// Using the method through Viem
async function Call() {
  try {
    // Method-specific Viem implementation
    const result = await client.request({
      method: "eth_getProof",
      params: [
        "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE",
        ["0x0"],
        "latest"
    ],
    });
    return result;
  } catch (error) {
    console.error("Viem Error:", error);
    throw error;
  }
}