state_queryStorageAt - Kusama
Example code for the state_queryStorageAt JSON-RPC method. Complete guide on how to use state_queryStorageAt JSON-RPC in GetBlock Web3 documentation.
Returns the values of a set of storage keys at a single block (or latest) in one call, as a list of key/value change sets. Efficient for reading many keys together.
Parameters
keys
array
Yes
Array of hex storage keys
at
string
Optional
Block hash; omit for the latest
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "state_queryStorageAt",
"params": [
[
"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9"
]
]
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'state_queryStorageAt',
params: [
[
"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9"
]
]
}, { headers: { 'Content-Type': 'application/json' } });
console.log(response.data.result);Response
Response Fields
block
string
Block hash the values were read at
changes
array
Array of [key, value] pairs; value null if empty
Use Cases
Batch Reads: Fetch many storage values in one request
Consistent Snapshot: Read all keys at the same block
Indexing: Efficiently backfill state
Error Handling
-32603 / Internal error
Unknown block
The block hash is not known
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Was this helpful?