> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_getProof | Fantom

> Fantom API method that returns a Merkle proof for a specific account, contract storage, or both for a given block. Fantom via Chainstack.

Fantom API method that returns a Merkle proof for a specific account, contract storage, or both for a given block. Merkle proofs enable users to verify the existence and authenticity of data within a Merkle trie, a data structure that helps optimize and secure data retrieval in blockchains.

> [!NOTE]
>
> When called against a block older than the latest \~128 blocks, this method is treated as an archive request (2 RUs instead of 1 RU). See [request units](https://docs.chainstack.com/docs/request-units.md#evm-methods-affected-by-block-age).

> [!NOTE]
>
> **No longer supported**
>
> The Sonic node client no longer supports `eth_getProof` for the Fantom chain. [See GitHub Issue](https://github.com/Fantom-foundation/Sonic/issues/379).

> [!WARNING]
>
> `eth_getProof` is not available on Fantom Global Nodes — the call returns `-32000 method handler crashed`. See [Fantom methods](https://docs.chainstack.com/docs/fantom-methods.md) for the methods that are available.

## Parameters

* `address` — Ethereum address of the account for which the proof is requested.
* `array` — the array of 32-byte storage keys that need to be proven and included. See [eth\_getStorageAt](https://docs.chainstack.com/reference/fantom-getstorageat.md).
* `quantity or tag` — the integer of a block encoded as hexadecimal or the string with:

  * `latest` — the most recent block in the blockchain and the current state of the blockchain at the most recent block.
  * `safe` and `finalized` — not supported on Fantom; the request fails with an `invalid argument` error. Fantom blocks are final as soon as they're produced, so use `latest`.
  * `earliest` — the earliest available or genesis block.
  * `pending` — the pending state and transactions block. The current state of transactions that have been broadcast to the network but have not yet been included in a block.

> [!NOTE]
>
> See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block).

## Response

* `balance` — represents the account balance. Refer to [eth\_getBalance](https://docs.chainstack.com/reference/fantom-getbalance.md).
* `codeHash` — indicates the code hash associated with the account. For a simple account without any code, the value will be `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`.
* `nonce` — refers to the account's nonce. See [eth\_getTransactionCount](https://docs.chainstack.com/reference/fantom-gettransactioncount.md).
* `storageHash` — represents the SHA3 hash of the StorageRoot. All storage data will provide a Merkle proof that starts with this `rootHash`. This hash serves as the starting point for obtaining a Merkle proof for all storage entries linked to the account.
* `accountProof` — an array of RLP-serialized Merkle trie nodes, starting with the `stateRoot` node and following the path of the SHA3 (address) as the key, which can be used to verify the existence and authenticity of data within the trie.
* `storageProof` — contains the requested storage entries in an array, with each entry being an object that includes the following properties:
  * `key` — the requested storage key
  * `value`— the value associated with the storage key
  * `proof` — an array of RLP-serialized Merkle trie nodes, starting with the `storageHash` node and following the path of the SHA3 (key), which can be used to verify the existence and authenticity of data within the trie.

## `eth_getProof` code examples

The following examples retrieve the Merkle proof for the USDC contract.

```javascript ethers.js theme={"system"}
const ethers = require('ethers');
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const provider = new ethers.JsonRpcProvider(NODE_URL);


async function getProof() {
    // Get the storage slot hash (value = keccak256(storage address + slot index))
    const storageSlotHash = '0x9c7fca54b386399991ce2d6f6fbfc3879e4204c469d179ec0bba12523ed3d44c';

    // Define the contract address for USDT
    const contractAddress = '0x8965349fb649A33a30cbFDa057D8eC2C48AbE2A2';

    // Get the Merkle proof of USDT's smart contract using a custom JSON-RPC call
    const proof = await provider.send('eth_getProof', [contractAddress, [storageSlotHash], 'latest']);

    const block = await provider.send("eth_getBlockByNumber", ["latest",false]);
    // The state root is crucial for Merkle verification
    const stateRoot = block.stateRoot;

    console.log('state root:', stateRoot);
    console.log(proof);
}
```

```python web3.py theme={"system"}
from web3 import Web3
httpUrl = "YOUR_CHAINSTACK_ENDPOINT"
web3 = Web3(Web3.HTTPProvider(httpUrl))

proof = web3.eth.get_proof('0x8965349fb649A33a30cbFDa057D8eC2C48AbE2A2', ["0x9c7fca54b386399991ce2d6f6fbfc3879e4204c469d179ec0bba12523ed3d44c"], "latest")
print(proof)
```

> [!NOTE]
>
> Read [Deep dive into Merkle proofs and eth\_getProof](https://docs.chainstack.com/docs/deep-dive-into-merkle-proofs-and-eth-getproof-ethereum-rpc-method.md) to learn more about the Merkle trie and how to use `eth_getProof`.

## Use case

A use case for the `eth_getProof` method can be when a decentralized application (DApp) interacts with a smart contract on the Fantom blockchain. The DApp needs to verify the state of the contract's storage variables without downloading the entire blockchain data. By using `eth_getProof`, the DApp can request Merkle proof for specific storage slots in the contract. This proof can then be used to cryptographically verify the authenticity and accuracy of the storage data, ensuring the DApp is working with the correct contract state.


## OpenAPI

````yaml openapi/fantom_node_api/eth_getProof.json POST /mt_c524ad9781ae5dccd9ac6f5b0370e
openapi: 3.0.0
info:
  title: Fantom Node API
  version: 1.0.0
  description: This is an API for interacting with a Fantom node.
servers:
  - url: https://fantom-mainnet.core.chainstack.com
security: []
paths:
  /mt_c524ad9781ae5dccd9ac6f5b0370e:
    post:
      tags:
        - upload
      summary: eth_getProof
      operationId: getProof
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  default: eth_getProof
                params:
                  type: array
                  items:
                    anyOf:
                      - type: string
                        title: Account address
                        description: The address of the account to query.
                      - type: array
                        title: Storage keys
                        description: An array of storage keys to query.
                        items:
                          type: string
                      - type: string
                        title: Block ID
                        description: The block number or tag to use as a reference.
                  default:
                    - '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82'
                    - - >-
                        0xf6e506a9cbe7546a796b187c40609a170ea8073e047129a3cae1c38e6d7559b7
                    - latest
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
      responses:
        '200':
          description: The account state proof.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object
                    properties:
                      accountProof:
                        type: array
                        items:
                          type: string
                      storageProof:
                        type: array
                        items:
                          type: object
                          properties:
                            key:
                              type: string
                            value:
                              type: string
                            proof:
                              type: array
                              items:
                                type: string

````