Skip to main content

linea_getProof

Returns the account and storage values, including the Merkle proof, of the specified account. The supplied block parameter must be an L2 block that has been finalized on L1.

  • When an account or storage slot exists, the response includes the leafIndex and a proof of existence.
  • When an account or storage slot doesn't exist, the response will include the proof of the elements before and after it in the tree.

In the example response the account exists but the slot doesn't.

Parameters​

  • address: A string representing the address (20 bytes) for which the proof is requested.
  • storageKeys: An array of 32-byte storage keys to be proofed and included.
  • blockParameter: A hexadecimal block number, or one of the string tags latest, earliest, pending, or finalized. :::note A finalized block is a block on an L2 blockchain (Linea) that has been confirmed and validated by the L1 blockchain (Ethereum). :::

Returns​

  • accountProof: Provides proof data for the account:
    • key: The address of the account for which the proof is generated.
    • leafIndex: The index of the leaf node in the sparse Merkle tree that corresponds to the account.
    • proof: Object containing the proof data for the account:
      • proofRelatedNodes: Array of nodes in the sparse Merkle tree used to construct the proof.
      • value: The value stored at the account's leaf node in the sparse Merkle tree.
  • storageProof: An array of storage-entries as requested. Each entry is an object with these properties:
    • key: The requested storage key.
    • leftLeafIndex: The index of the left leaf node in the sparse Merkle tree that corresponds to the storage slot.
    • leftProof: Contains the proof data for the left leaf node, which includes the array of nodes used to construct the proof and the value stored at the left leaf node in the sparse Merkle tree.
    • rightLeafIndex: The index of the right leaf node in the sparse Merkle tree that corresponds to the storage slot.
    • rightProof: Contains the proof data for the right leaf node, which includes the array of nodes used to construct the proof and the value stored at the right leaf node in the sparse Merkle tree.

Example​

Request​

curl https://linea-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "linea_getProof",
"params": [
"0x87f21c771EAC9c547Eb22312997153D3A1fC40F6",
["0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"], "0x7AA88B"
],
"id": 1
}'

Response​

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountProof": {
"key": "0x87f21c771eac9c547eb22312997153d3a1fc40f6",
"leafIndex": 2410424,
"proof": {
"proofRelatedNodes": [
"0x000000000000000000000000000000000000000000000000000000000075965e0a85198ef8a5f75a15db565de5bff89b409ff5e507a7be546149c32b99044df3",
"0x008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809",
"0x060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b",
...
],
"value": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001f2f46337996eabca16927c459f3fbdb8fb82672c464aa332b613a3c08db27c03dcbfed33825518e0122265146c2948b3bcb9b173348556e13c462f7a6b1a86f7d11acadc51eaeba164e92ebb5ecbe6c64ebc7d0190f93bf0edebeadf610ad80000000000000000000000000000000000000000000000000000000000001c85"
}
},
"storageProofs": [
{
"key": "0x0000000000000000000000000000000000000000000000000000000000000001",
"leftLeafIndex": 0,
"leftProof": {
"proofRelatedNodes": [
"0x00000000000000000000000000000000000000000000000000000000000000030961e5d86a7bbdaac1547b2abfdb09dcaa0548b3d277a154b8c89081a22195a4",
"0x008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809",
"0x060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b",
"0x0a06dc31ae8e893bca0a076decb8c0caa9036b5f394abf79d7956411eef322550a06dc31ae8e893bca0a076decb8c0caa9036b5f394abf79d7956411eef32255",
...
],
"value": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"rightLeafIndex": 2,
"rightProof": {
"proofRelatedNodes": [
"0x00000000000000000000000000000000000000000000000000000000000000030961e5d86a7bbdaac1547b2abfdb09dcaa0548b3d277a154b8c89081a22195a4",
"0x008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809008a47a2a53dd5183a2dc127c399a004e2a6c7e60f73e104d7d79e6a2bd7e809",
"0x060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b060f08aed06ffb90efc9705dc38d37a7000da1add99cef1b8a84b9e72e7c8b7b",
"0x0a06dc31ae8e893bca0a076decb8c0caa9036b5f394abf79d7956411eef322550a06dc31ae8e893bca0a076decb8c0caa9036b5f394abf79d7956411eef32255",
...
],
"value": "0x0000000000000000000000000000000000000000000000000000000000000064"
}
}
]
}
}