eth_getProof

Returns the account and storage values of the specified account including the Merkle-proof. This call can be used to verify that the data you are pulling from is not tampered with.

Parameters

  1. DATA, 20 Bytes - address of the account.

  2. ARRAY, 32 Bytes - an array of storage-keys that should be proofed and included. See eth_getStorageAt

  3. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

Object - account object:

  • balance: QUANTITY - the balance of the account. Seeeth_getBalance

  • codeHash: DATA, 32 Bytes - hash of the code of the account. For a simple Account without code it will return "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"

  • nonce: QUANTITY, - nonce of the account. See eth_getTransactionCount

  • storageHash: DATA, 32 Bytes - SHA3 of the StorageRoot. All storage will deliver a MerkleProof starting with this rootHash.

  • accountProof: ARRAY - Array of rlp-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the path of the SHA3 (address) as key.

  • storageProof: ARRAY - Array of storage-entries as requested. Each entry is an object with these properties:

    • key: QUANTITY - the requested storage key

    • value: QUANTITY - the storage value

    • proof: ARRAY - Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the path of the SHA3 (key) as path.

Example

NOTE: In this example we are using public Ethereum endpoint. Ideally, for your own projects, you should use your own endpoint, which you can generate for free by connecting to your wallet here.

Query

NOTE: ethers used below is a well-known web3 library, check it out here.

import { ethers } from 'ethers';

const provider =
  new ethers
    .providers
    .JsonRpcProvider("https://www.noderpc.xyz/rpc-mainnet/public")

provider.send('eth_getProof', ["0x67b1d87101671b127f5f8714789C7192f7ad340e", [], "latest"]).then((result) => {
  console.log(result);
});

Result

{
    "address": "0x67b1d87101671b127f5f8714789c7192f7ad340e",
    "accountProof": [
        "0xf90211a023e5f8d69233ddc1f1eba1eb78850abdf01e45ed2a9d19481fc69b0c647b15caa0a73b1b2b3b42265c02846d46b137cebb1d719bf61df83ea23a63c4568236ec48a00b7446b9ed0ff4e10f9aa2a67d1585b1e0d65228c3e47f2fe75771a65c58a63da0598b50d4a9610346a40e1ae5308098820af8a192f8b9f643ea5af6450cd97359a0cefe6367f28166cbbad79a45610c3944f96e8fbcedc7b4ca7e0784d1ca990479a0e80c53776588548abf63d950946025d932c55602bbaa20276a7cb0d5ebd10e4aa088ef8fef59a7aa6d9c2cf9e4ef789f255992d6099af0761bc6fce95612ed9910a0c8169f62d5adba6dbf808d4e6a1f1bc6662c503e0009f21f620dd7b0862ffa42a0fa09fba3535792bd11c84549933c2a89aa3811158a818bce74be670b3c283af8a0f6cce9f8c54c25e1c53718fbb78f7f794ddbc7864e8187a36b3145f90affbe95a00eeb1e80c230d52c0827e182bb665b681d668d643f85c74cfe424aedf89a0315a04fbaa3d0a18e385773138ac57e91f12610acb74c2a56ef0c186b947d18cbedd0a0ee7fb3ec334faf20a88827aaf41c67e2560eefc877d3cf3887c2665d017abca5a095687c80429c10d525f44970d0bbcadca42ae5132816dd6827981686ee4e94bfa0fce98fbc2342dc260a62558dc00f64110a011b352776384599ba33ca9355d97ba0669585ec052442489a0f7b033dd43b0a029ea80115ad6a34fdd983560762feae80",
        "0xf90211a0842de07d01d6bea33baf258378bb4ef5342d08f10bcf4029bbf27019bf3f5cb0a02ef3f2cdf9aed9f2369d4e1650f3ea9fe744536e3f4abc14771372dba982b044a00b2aa06175b9d51f13c75486053c8cc537cbb7026ac6c9fe556614e5b1657560a0263c514ddda6975d4c98668cf30302fa4c444e434667eb12a1b305cd3f234a9ba04435ce373d7e01b20df618ff3521fdbbba821755152d6979fa8798f0e9579730a02edc56d2a4ccd559dcb7aa2fbc246f2e1d33e3eabe7f31bc5636354d1d2d974ca0a2b4244a40758e5ae58a9e9803170266a6b3fc086442cb82d1be066a3e81ba61a0d7db7816278c46b3369c858d93f20b1316376b5749439b7ab0a0f608225d68b1a08522806f494f84d45cb1969cb61bdf81be8295933e3f697d6d78298024662eafa02368f1742bbde0134a1ae7b8032b64ab3cef4b9fa6f29d4b55f10ed98eb16f52a00b491ac1108cbcfb8ecc7d8070bb20094b7285caa587b9820764664e2b9bd8eba0e1b46e60f004212fe7c0208f32fd3f939fcec76e564f783370a8c0bf9c0f9bd7a00b5dd7e74fd78a3086ad122629b37ca294ed8216b07fcdb5dea300e24ec02f0ca047a6185a1f29974303d849cbc1a63722aca5afc9dc43f75d9450bf34aa8fc9b2a04c4dce3ae96dc23370318b116299ee53436208953b4f44a27cdd1bcbaaf0f5e8a0360777efa2cf015471e19a717899d6f3dc11eb0b523974ce48f8942890a904e280",
        "0xf90211a02e13ffc78172162bb8cf039508f28d341b985b8f5ec7128a408f189080116cdba0130d9185a97aaf900f55f73ee4ae8a5c3e013fd44aa4bd735263cb7b6ead799ea07660db1246806555e3318495539943766b4191ff9002cb9cc0a3de9013f00beaa0dd194efbcc737bf53cb1455d162847a4aaa35e50e84884b62a9769621d0cfdf7a0eea2f54482df6c1caef1aba3a9b0323b38f4a2f7edd4723c42d818e5b09ba473a06ce048085c47e668ea1210b69974d84d207133ce9b9905c1e9a651b060e24f3fa08b540ac3d5e0caea30a4e2809f39acb58ef5b983d3068c286057ee92770a214fa0322990ffd1c5bc3dbcfd61319e4c6c76a4799372faf259c7d1e97c3ed7e2257ca0f36bd3371072e87669c1eeed9f8875568d516635ad46b551243ea10b858627eda01f3cc6ef6b88c2045992e9a8b204a4a1a83c6c4662ecb7e4330b40f67dcb9762a08d59b0e2aabc1ec38867b53829834ee136eb76a7ac3b9314b7dbffe5ba19ff0ca04589e189f4bffe2568a0711c8068eba62aaab77b39db4ad0a5aaf414d9d377eea0e4e69a4bcdba21d87c5013205ec389e6a012434e9c889abc7e98733a3916b60ea00576dda677e2ca522615aca4443bcbac1fb2d204b68af1a8c12151b2403430a0a010c9b4b53001a6f111fa0eeeedea8db300b7d1e3b220ff27f9ef90f92cea1e53a0932cd5f6512a28992504c9d13ac7b13adc9245beaef50fb7d7158740a70965e380",
        "0xf90211a00e75079fbb4e71752fd1752de20614a33adda70950a2f8a86e94617a3a5d35d1a00b5d4ddceaa666839a546a8e6e7b56384bc0e80da1ee81afc95ce77223434d8ea0925a81f557ed5528f0d2e9ffbf44539ec2f809e80bbe50c669d9f246996bc8e6a085ffcbd1b16b5ee489e1882342b4b365847a7659e464f19ee128abc795f67a5aa013f4e4ca650820000d297373f3967d964c39167edaec3d80b24ecb7ad7df6db9a0663fef519e09a64ad7650b3ea93ae828907c692f121ebd2381e3f6769707f05aa08020baff5f24e6b8872a035fcf0e097189b6ddcfdb9a5d4c3dd7372d4993ee0ba003424be766629258946a1ea7a4e824b6b37d82743b3ca047076cfc4b859f2e88a074a7c5a5ec417ab182a359e370918f3d2ceded338823bc0eaec3f140d88cf54ba0d37eb0966f7eab609c3dfa1047efa979e5d4989a208fb691b76525beab431bdea0e447f3e42fb7980e91e526785b68c638d56cce271be239cd8b3ea7fbec5d4ebca09e8c84c12b0bfbc51cbcc1eb8eadb412cf4f8dbf5156e54620d22a41d84fef4da0c379950460cc6894a40eb2d20cafac4c4cd3b327563b97ae0f0ae1f20aa00258a088d0bf2bc60edf1518bed72861615864d0ba547fe8576dfeb8e959dbbf1e5167a04d0d13aaafda8e03a2b5151fdafe47833d8a3165d14410d8f0eaee48853b6214a041507a56b27cee5c8c3abdada6086dceb025c48503747cd3b7bc7df6a9bc400c80",
        "0xf90211a09d4e56faade499fddb38b8e6908e96df52fb3481849ee430d0e59c90c1e93df2a09d0dc6045f64ff20652d8898fa2af2108697ed15c51a64800f39e85cc3cc9d0aa017589d7989c2d33595a2a737f220da9f7fb8ffa54e4f164e09459d30364860fba0df9b321dae90e56310f369e92cd3570db2b6c0f443befee2bf38cb3124af77cca0b0692ceb52dbc714bf715a83e4f010ddb2f0eccdb66b210d92fc9f29f202e3e4a096887cc3c742db7556420813df5ccde979739a8de7b9bd5423bf0b4b3a6276b9a087a61f39aee03a47bbb117a0654373659cb9329583943d457f831e4c96c2a37ba03157607b7f7449a52e5a4ee58de7df932281115d2eef8676da611483ec7c692ba0a404d3a2a69fe450b1ff7670eb0856dc8c356b14ff09f822ed0372317eb60348a0bbc0e74feade79f47e2d3c7e9bb57bc3e0e77d226a2f9b6704b0a546f55f56d3a0d088252f1f9402122e57cebcbe18332d25e8e3df2eb387782f62fa9ae22c4c83a07c426bdb19f50e278a3870823f236e543b52c2d1362d3f9f2a0d9440759587fba0b008bb4830c6061c0aee4d5c11627dc19f6094cf1e76311ea2770a3354c17518a0307f26df81cdb188e8a9a778b9795fc624a3bd15b07226ec13de9506ababc745a016193d245098f369739b504338f7a682956d71cb3d146b5036239937a9d9258fa0d24776fd362692f3ba3c5be5d1c704f5625776c447167a409e5dc189cf15333780",
        "0xf90211a08cc2b5e4c265dde9b688ad791fb409020c6ca6508287b6e2c5427c90eb36d6c6a013770d8f371d4e388abde29cffa636572e40f2211b506958f160c0c8a9d3a94ca054c6906fda74693c0f3f6e0078547badf546d60fded8e67f79e5a48349723669a0995e3d75f03fac1f5c8d8d7225371db13469986e89d428333f4eb39250ab9400a0e162a23f640c767bd584d798d264268dfbc49291ca01d87cc099d3a96938e6fda03dcb0a5509acb847e7a05fa23b2f1094636c61213c2e1b0640a63213e9c1de4aa0bd5a35f4b2e3783f8f110e654bad17e50b02ee6ad46719b9de8a7435432ca3d5a08e99846338bccdca31435e048bc2bbb890abbcc2782ceaf7c7d3bcdb9f0215a4a01db14dce6d1eb662151ce2ca20db83cd9b29f226e3036eeea35c6430b4659008a0a709af233f0543f68e8d68de17fa78cb6eadbf683c027e7d720a97f75eab06a5a0998c1cf072aed47537fbbd36a492779e012adea66eaaa2c70419a382c59fdb6ba0f218ed22e1c0db04f737c87bb8ee96e2631109dde95678f486e78c9b454e4012a02285d66e2444ed170186537b904a42536e2a057c3419694a0ed057e8d0a1eb84a06dd8a2e8cae44108275d93e751c9d37d24b14ee519e01bf00b2ddef702d09477a0ff17fc61f2ecf7c593e490454ebd5fae31885061e303fb9b7856a9d60de2128ba09ccc94443fc2dbed5a21e9118952f51aabb0ee00194e806da06249082967236580",
        "0xf8b1808080a094a3ff9b072df0c28588f0bf0af896963aacecb454f8af07fae5c88486bc1857a0a2c71ec54a72dcdf7463df7f6d3786f78d9ce9c302022ddfc8238b2a27c141d3a00ac51a5135a7704294ba726d4538cce99de5b823afcff6788bf204496ad2bed28080a0a40a956781dfdfe0076e0ea57d1d1aba03b6dae7bf7a5c33fff40720023acb51808080a075ede8efebeaf33615a426f1086ce38029ad95d9863fde33ac146ba0e30336e780808080",
        "0xf8699d3a27dd7524955417c11ecd917251cc7c4c8310f4c7e4bd3c304d3d9a79b849f847038320423da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
    ],
    "balance": "0x20423d",
    "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
    "nonce": "0x3",
    "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "storageProof": []
}

Last updated