system_health
Returns the health status of the Asset Hub node.
Use Cases#
- Health checks - Monitor node availability
- Load balancing - Route traffic based on health for native stablecoin transfers (USDC, USDT), DOT staking and governance, and cross-chain asset management via XCM
- Sync status - Verify node is synced
Parameters#
This method accepts no parameters.
Returns#
| Field | Type | Description |
|---|---|---|
peers | Number | Connected peer count |
isSyncing | Boolean | Whether node is syncing |
shouldHavePeers | Boolean | Whether node should have peers |
Request#
{
"jsonrpc": "2.0",
"method": "system_health",
"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": "system_health",
"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 health = await api.rpc.system.health();
console.log('Peers:', health.peers.toNumber());
console.log('Is syncing:', health.isSyncing.isTrue);
await api.disconnect();
import requests
def get_health():
url = 'https://api-asset-hub-polkadot.n.dwellir.com/<YOUR_API_KEY>/YOUR_API_KEY'
payload = {
'jsonrpc': '2.0',
'method': 'system_health',
'params': [],
'id': 1
}
response = requests.post(url, json=payload)
return response.json()['result']
health = get_health()
print(f"Peers: {health['peers']}")
print(f"Syncing: {health['isSyncing']}")
Related Methods#
system_version- Get node versionsystem_chain- Get chain name