state_getKeys - Kusama
Example code for the state_getKeys JSON-RPC method. Complete guide on how to use state_getKeys JSON-RPC in GetBlock Web3 documentation.
Returns all storage keys that start with a prefix at a block. For large maps, use state_getKeysPaged instead to avoid oversized responses.
Parameters
Parameter
Type
Required
Description
prefix
string
Yes
Hex key prefix
at
string
Optional
Block hash; omit for 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_getKeys",
"params": [
"0x26aa394eea5630e07c48ae0c9558cef7"
]
}'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_getKeys',
params: [
"0x26aa394eea5630e07c48ae0c9558cef7"
]
}, { headers: { 'Content-Type': 'application/json' } });
console.log(response.data.result);Response
Response Fields
Field
Type
Description
result
array
Hex storage keys matching the prefix
Use Cases
Key Discovery: Find storage keys under a pallet prefix
Small Maps: Enumerate a small storage map
Debugging: Inspect which keys exist
Error Handling
Error
Message
Description
-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
Last updated
Was this helpful?