API Reference

cfx_getStorageRoot - Conflux

Returns the storage root of a given contract.

Parameters

  • BASE32 - Address of the contract.
    QUANTITY|TAG - (optional, default: "latest_state") Integer epoch number, or the string "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter

Returns

Object - A storage root object, or null if the contract does not exist:

  • delta: DATA, 32 Bytes - The storage root in the delta trie, or the string "TOMBSTONE", or null.
  • intermediate: DATA, 32 Bytes - Storage root in the intermediate trie, or the string "TOMBSTONE", or null.
  • snapshot: DATA, 32 Bytes - Storage root in the snapshot, or the string "TOMBSTONE", or null.

If all three of these fields match for two invocations of this RPC, the contract's storage is guaranteed to be identical. If they do not match, storage has likely changed (or the system transitioned into a new era).


Example

Request

curl -X POST \
--data '{"jsonrpc":"2.0","method":"cfx_getStorageRoot","params":["cfx:type.contract:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp","latest_state"],"id":1}' \
-H "Content-Type: application/json" \
https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577 


Result

{
    "jsonrpc": "2.0",
    "result": {
        "delta": null,
        "intermediate": "0x7f9ccd7a5f68b2356044c566c0a2d7035c4fbe504788756faed8533dc93b21f9",
        "snapshot": "0x234e9523c8df007a255e75927d7005e588b5226bcf6e2d804af443ef2559a3ce"
    },
    "id": 0
}
Language
URL
Click Try It! to start a request and see the response here!