state_callAt - Midnight

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

This method executes a runtime API call at a specific historical block. Same semantics as state_call, but at a chosen block hash.

Parameters

Parameter
Type
Required
Description

name

string

Yes

Runtime API method name

bytes

string

Yes

SCALE-encoded call parameters (hex)

hash

string

Yes

Block hash at which to execute

Request Example

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

Response Example

Response Parameters

Field
Type
Description

result

string

SCALE-encoded return value (hex)

Use Cases

  • Reading runtime state at historical heights

  • Replaying typed queries across blocks

  • Auditing state changes between block heights

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

The method is not enabled on this node or has been deprecated

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?