Skip to main content

state_getKeysPaged

Retrieve keys that have a specified prefix, with support for pagination.

Example Request and Result for state_getKeysPaged method

In this section, we provide an illustrative example of a request made to retrieve details contents using the state_getKeysPaged method. Additionally, we present the resulting response containing information about retrieving keys that have a specified prefix.

Parameters

FieldsTypeDescription

storageKey*

stringThe key prefix to retrieve matching keys from

count*

number

An unsigned 32-bit integer, specifying the number of results to include per page

startKeystring

This parameter is used for pagination, indicating the starting key to fetch results from. If not provided, the request will start from the beginning

blockhashstring

The hash of a specific block in the chain. Providing this parameter ensures that the keys are queried at the state corresponding to that block. If not provided, the request will use the latest block

info

The example in this section uses a non-existing project id.

Make sure you replace it with your Vara Mainnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Retrieve the keys that have a specified prefix.

POST https://vara-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription
storageKey*string
count*number3
blocknumberstring
startKeystring
{
"jsonrpc": "2.0",
"result": [
"0x074b65e262fcd5bd9c785caf7f42e00a29f2dc2b64e354002faef2a81f1aa8bb023b132c8749409e7a3c72501a850a8505fddd9f98a480ff56ba66458850ec284f43436aadcd995af1577fbf1d628fdd0100",
"0x074b65e262fcd5bd9c785caf7f42e00a29f2dc2b64e354002faef2a81f1aa8bb02f2c82a5f9fe57afc092450d8af16c576f5b49f05ae7b623ac61025e4d67f684d5bfd6f7b98305cebef10b1ae3740420a00",
"0x074b65e262fcd5bd9c785caf7f42e00a29f2dc2b64e354002faef2a81f1aa8bb0730238369be20c7c82c0b4a60d87897f4896d6e58093ac3cee3b46283f4b49cb2b5533c6c88ec87f1577fbf1d628fdd0100"
],
"id": 1
}

Curl Request example

curl --location 'https://vara-mainnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "state_getKeysPaged",
"params": {
"storageKey":"",
"count":3,
"startKey":"",
"blocknumber":""
}
}'