state_call - Midnight

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

This method executes a runtime API call at the current best block without submitting an extrinsic. Use it to query typed runtime entrypoints such as AccountNonceApi_account_nonce.

Parameters

Parameter
Type
Required
Description

name

string

Yes

Runtime API method name (e.g. Core_version)

bytes

string

Yes

SCALE-encoded call parameters (hex)

Request Example

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

Response Example

Response Parameters

Field
Type
Description

result

string

SCALE-encoded return value (hex)

Use Cases

  • Reading typed runtime state through stable API entrypoints

  • Querying fees, account info, or custom pallet APIs

  • Building higher-level SDK methods on top of typed runtime calls

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?