chain_getRuntimeVersion - Polkadot

This method returns the runtime version at a given block. It is a deprecated alias of state_getRuntimeVersion, kept for compatibility.

Parameters

ParameterTypeRequiredDescription
atstringNoBlock hash to query at. Defaults to the latest block when omitted

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0", "method": "chain_getRuntimeVersion", "params": [], "id": "getblock.io"}'

example.js

javascriptconst response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        jsonrpc: '2.0',
        method: 'chain_getRuntimeVersion',
        params: [],
        id: 'getblock.io'
    })
});

const data = await response.json();
console.log(data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'chain_getRuntimeVersion',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

Response

json{
    "id": "getblock.io",
    "jsonrpc": "2.0",
    "result": {
        "specName": "polkadot",
        "implName": "parity-polkadot",
        "authoringVersion": 0,
        "specVersion": 1002000,
        "implVersion": 0,
        "apis": [
            [
                "0xdf6acb689907609b",
                5
            ],
            [
                "0x37e397fc7c91f5e4",
                2
            ]
        ],
        "transactionVersion": 26,
        "stateVersion": 1
    }
}

Response Parameters

ParameterTypeDescription
idstringRequest identifier matching the request
jsonrpcstringJSON-RPC protocol version ("2.0")
resultobjectRuntime version object

Result Object

FieldTypeDescription
specNamestringRuntime specification name (polkadot)
implNamestringRuntime implementation name
specVersionintegerRuntime spec version; increments on a runtime upgrade
transactionVersionintegerVersion of the transaction format
apisarraySupported runtime API identifiers and their versions

Use Cases

  • Upgrade Detection: Detect runtime upgrades by watching specVersion
  • Compatibility Checks: Confirm supported runtime API versions
  • Legacy Tooling: Support clients that call the chain_ alias
  • Diagnostics: Read the runtime version at a block

Error Handling

Error CodeMessageDescription
-32602Invalid paramsA parameter is missing or has the wrong type or format
-32601Method not foundThe method is not available on this endpoint
-32603Internal errorThe node failed to process the request

Library Integration

The idiomatic way to call Polkadot RPC is the Polkadot.js API (@polkadot/api), which connects over WebSocket and exposes the method as api.rpc.state.getRuntimeVersion.

polkadot-js.js

javascriptimport { ApiPromise, WsProvider } from '@polkadot/api';

const provider = new WsProvider('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');
const api = await ApiPromise.create({ provider });

const result = await api.rpc.state.getRuntimeVersion();
console.log(result.toHuman());