childstate_getStorageEntries - Midnight

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

This method returns multiple values from a child trie in a single call. More efficient than calling childstate_getStorage once per key.

Parameters

Parameter
Type
Required
Description

childStorageKey

string

Yes

Hex-encoded identifier of the child storage trie

keys

array of string

Yes

Array of hex-encoded keys to read

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": "childstate_getStorageEntries",
    "params": [
        "0x3a6368696c645f73746f726167653a64656661756c743a",
        [
            "0x80",
            "0x81"
        ]
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

array of string | null

Array of hex-encoded values, in the same order as the requested keys

Use Cases

  • Batched reads of contract state

  • Reducing round-trips when fetching multiple related values

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?