Skip to main content

starknet_getStateUpdate

Returns information about the result of executing the specified block.

Parameters

block_id: [Required] The block parameter object containing one of the following:

  • block_hash: (string) Block hash.
  • block_number: (integer) Decimal block number.
  • One of the string tags latest or pending.

Returns

A state update object or pending state update object containing:

  • block_hash: The block hash. This is not included in a pending state update object.
  • old_root: The previous global state root.
  • new_root: The new global state root. This is not included in a pending state update object.
  • state_diff: The change in state applied in this block, as a map of addresses to the new values and/or contracts.

Example

Replace <YOUR-API-KEY> with an API key from your MetaMask Developer dashboard.

Request

curl https://starknet-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_getStateUpdate",
"params": {
"block_id": {
"block_hash": "0x041b10c45dc3f39372f7b9409261cac9d880c5d75a5bb077d028db20b1bd76c4"
}
},
"id": 0
}'

Response

{
"jsonrpc": "2.0",
"result": {
"block_hash": "0x18ec1a3931bb5a286f801a950e1153bd427d6d3811591cc01e6f074615a1f76",
"new_root": "0xc95a878188acf408e285027bd5e7674a88529b8c65ef6c1999b3569aea8bc8",
"old_root": "0x7dd643fa7f254c8932c01558f538292304266c00728eeaf4b32b361b5d0d2dd",
"state_diff": {
"storage_diffs": [
{
"address": "0x653d92ffdf2b532003d5e989f763fdedc16dc389e0b3889398a6eb1dac0d849",
"key": "0xf920571b9f85bdd92a867cfdc73319d0f8836f0e69e06e4c5566b6203f75cc",
"value": "0x69577e6756a99b584b5d1ce8e60650ae33b6e2b13541783458268f07da6b38a"
},
{
"address": "0x653d92ffdf2b532003d5e989f763fdedc16dc389e0b3889398a6eb1dac0d849",
"key": "0x1379ac0624b939ceb9dede92211d7db5ee174fe28be72245b0a1a2abd81c98f",
"value": "0x36dbe3ef0a6ef13fc20e65315840832c0595986d54eba528e22483c7746c005"
},
{
"address": "0x653d92ffdf2b532003d5e989f763fdedc16dc389e0b3889398a6eb1dac0d849",
"key": "0x1813aac5f5e7799684c6dc33e51f44d3627fd748c800724a184ed5be09b713e",
"value": "0x4"
},
{
"address": "0x653d92ffdf2b532003d5e989f763fdedc16dc389e0b3889398a6eb1dac0d849",
"key": "0x321bace1036eaff095582583849a03598bd5764a6265edac86916b830a29d55",
"value": "0x1"
},
{
"address": "0x653d92ffdf2b532003d5e989f763fdedc16dc389e0b3889398a6eb1dac0d849",
"key": "0x37501df619c4fc4e96f6c0243f55e3abe7d1aca7db9af8f3740ba3696b3fdac",
"value": "0x3"
}
]
}
}
}