state_getRuntimeVersion - Midnight

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

This method returns the runtime version at the current best block. Functionally identical to chain_getRuntimeVersion with no parameter.

Parameters

Parameter
Type
Required
Description

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

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "specName": "midnight",
        "implName": "midnight",
        "authoringVersion": 1,
        "specVersion": 130,
        "implVersion": 0,
        "transactionVersion": 1,
        "stateVersion": 1
    }
}

Response Parameters

Field
Type
Description

result.specName

string

Runtime spec name

result.specVersion

integer

Runtime spec version

result.transactionVersion

integer

Transaction format version

Use Cases

  • Detecting runtime upgrades

  • Tooling that prefers the state namespace over chain

Error Handling

Status Code
Error Message
Cause

404

Not Found

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?