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

state_getReadProof - Midnight

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

This method returns a Merkle proof of inclusion for one or more storage keys. Light clients use these proofs to verify storage values without trusting the RPC provider.

Parameters

Parameter
Type
Required
Description

keys

array of string

Yes

Array of hex-encoded storage keys

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

Response Example

Response Parameters

Field
Type
Description

result.at

string

Block hash at which the proof was generated

result.proof

array of string

Hex-encoded Merkle trie nodes forming the proof

Use Cases

  • Light client state verification

  • Cross-chain bridges that prove Midnight state to other chains

  • Trust-minimized state queries

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?