For the complete documentation index, see llms.txt. This page is also available as Markdown.

state_getKeysPaged - Midnight

Example code for the state_getKeysPaged JSON-RPC method. Complete guide on how to use state_getKeysPaged JSON-RPC in GetBlock Web3 documentation.

This method returns paged storage keys with an optional prefix, allowing efficient iteration over large storage maps. Use the startKey parameter to continue from a previous page.

Parameters

Parameter
Type
Required
Description

prefix

string

Yes

Hex-encoded storage key prefix

count

integer

Yes

Maximum number of keys to return

startKey

string

No

Hex-encoded key to start from (exclusive). Used for pagination

hash

string

No

Block hash to query at. Defaults to the current best block

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "state_getKeysPaged",
    "params": [
        "0x26aa394eea5630e07c48ae0c9558cef7",
        100
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

array of string

Array of hex-encoded storage keys

Use Cases

  • Iterating large storage maps without overwhelming the node

  • Snapshot exporters and indexers

  • Building custom state pruning tools

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?