⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

state_getRuntimeVersion

Description

Returns the current runtime version, including specVersion and transactionVersion. Applications must monitor these values to refresh metadata and rebuild extrinsics after upgrades.

Parameters

ParameterTypeRequiredDescription
blockHashstringNoBlock hash to query historical versions

Returns

FieldTypeDescription
specNamestringRuntime specification name
implNamestringImplementation name
authoringVersionnumberAuthoring version
specVersionnumberRuntime spec version
implVersionnumberImplementation version
transactionVersionnumberTransaction version
apisarraySupported runtime APIs and versions

Request Example

{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}

Response Example

{
"jsonrpc": "2.0",
"result": {
"specName": "bifrost_polkadot",
"implName": "bifrost-node",
"authoringVersion": 1,
"specVersion": 21001,
"implVersion": 0,
"transactionVersion": 1,
"apis": [
["0xdf6acb689907609b", 4],
["0x37e397fc7c91f5e4", 2],
["0xd2bc9897eed08f15", 3]
]
},
"id": 1
}

Code Examples

JavaScript

const runtime = await api.rpc.state.getRuntimeVersion();
console.log(`Spec ${runtime.specVersion.toNumber()} txVersion ${runtime.transactionVersion.toNumber()}`);

Python

version = substrate.rpc_request('state_getRuntimeVersion', [])["result"]
print(version['specName'], version['specVersion'])

Tips

  • Trigger metadata refresh whenever specVersion changes.
  • If transactionVersion increments, rebuild and re-sign extrinsics; old payloads will be rejected with 1010: Invalid Transaction.