state_getRuntimeVersion
Returns the runtime version on Asset Hub.
Use Cases#
- Version checking - Verify runtime compatibility
- Upgrade detection - Monitor for runtime upgrades on native stablecoin transfers (USDC, USDT), DOT staking and governance, and cross-chain asset management via XCM
- Client compatibility - Ensure API compatibility
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
blockHash | String | No | Block hash for historical version |
Request#
{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}
Code Examples#
- cURL
- JavaScript
- Python
curl https://api-asset-hub-polkadot.n.dwellir.com/<YOUR_API_KEY>/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "state_getRuntimeVersion",
"params": [],
"id": 1
}'
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-asset-hub-polkadot.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
const version = await api.rpc.state.getRuntimeVersion();
console.log('Spec name:', version.specName.toString());
console.log('Spec version:', version.specVersion.toNumber());
console.log('Impl version:', version.implVersion.toNumber());
await api.disconnect();
import requests
def get_runtime_version():
url = 'https://api-asset-hub-polkadot.n.dwellir.com/<YOUR_API_KEY>/YOUR_API_KEY'
payload = {
'jsonrpc': '2.0',
'method': 'state_getRuntimeVersion',
'params': [],
'id': 1
}
response = requests.post(url, json=payload)
return response.json()['result']
version = get_runtime_version()
print(f"Spec: {version['specName']} v{version['specVersion']}")
Related Methods#
state_getMetadata- Get runtime metadatasystem_version- Get node version