state_getRuntimeVersion
Description
Returns the runtime API versioning information for the current block. Use this to decide when to refresh metadata, regenerate type bundles, or deploy runtime-dependent logic.
Parameters
Position | Type | Description |
---|---|---|
0 (optional) | string | Block hash to query. Defaults to the latest block when omitted. |
Returns
Field | Type | Description |
---|---|---|
specName | string | Runtime name (e.g., astar ) |
implName | string | Implementation identifier |
specVersion | number | Runtime spec version |
implVersion | number | Implementation version |
transactionVersion | number | Extrinsic format version |
apis | array | Supported runtime APIs and versions |
Request Example
{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}
Response Example
Captured 2025-10-03
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"specName": "astar",
"implName": "astar",
"authoringVersion": 1,
"specVersion": 1700,
"implVersion": 0,
"transactionVersion": 3,
"apis": [
["0xdf6acb689907609b", 5],
["0x37e397fc7c91f5e4", 2],
"… truncated …"
]
}
}
Code Examples
cURL
curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}'
JavaScript (polkadot.js)
const api = await ApiPromise.create({ provider: new WsProvider('wss://api-astar.n.dwellir.com/YOUR_API_KEY') });
const runtime = await api.rpc.state.getRuntimeVersion();
console.log(`spec=${runtime.specVersion} tx=${runtime.transactionVersion}`);
Python (py-substrate-interface)
from substrateinterface import SubstrateInterface
substrate = SubstrateInterface(url="wss://api-astar.n.dwellir.com/YOUR_API_KEY", ss58_format=5)
version = substrate.get_runtime_version()
print(version['specVersion'], version['transactionVersion'])