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

childstate_getKeys - Midnight

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

This method returns all storage keys in a child trie that match an optional prefix. Child tries are isolated key-value namespaces used by pallets such as contracts for per-contract storage.

Parameters

Parameter
Type
Required
Description

childStorageKey

string

Yes

Hex-encoded identifier of the child storage trie

prefix

string

Yes

Hex-encoded key prefix within the child trie

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

Response Example

Response Parameters

Field
Type
Description

result

array of string

Array of hex-encoded keys in the child trie

Use Cases

  • Reading per-contract storage in WASM smart contracts

  • Indexers that need to enumerate child trie contents

  • Debugging contract state

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?