system_health
Description
Returns the node health status, including peer count, synchronization state, and whether the node expects peers. Use this endpoint for readiness probes and observability dashboards.
Parameters
This method does not take any parameters.
Returns
Field | Type | Description |
---|---|---|
peers | number | Number of connected peers |
isSyncing | boolean | Whether the node is currently syncing |
shouldHavePeers | boolean | Whether the node is expected to maintain peer connections |
Request Example
{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}
Response Example
{
"jsonrpc": "2.0",
"result": {
"peers": 23,
"isSyncing": false,
"shouldHavePeers": true
},
"id": 1
}
The exact numbers vary with network conditions; a healthy collator typically reports >8 peers and isSyncing: false
.
Code Examples
cURL
curl https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}'
JavaScript (fetch)
const checkHealth = async () => {
const response = await fetch('https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'system_health',
params: [],
id: 1
})
});
const { result } = await response.json();
if (result.isSyncing) {
console.warn('Node is still syncing, retry later.');
}
if (result.shouldHavePeers && result.peers < 4) {
console.warn('Peer count is low, investigate network connectivity.');
}
return result;
};
Python (requests)
import requests
import json
def get_health():
url = "https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY"
payload = {
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}
response = requests.post(url, headers={"Content-Type": "application/json"}, data=json.dumps(payload))
response.raise_for_status()
return response.json()["result"]
health = get_health()
print("Peers:", health["peers"])
print("Syncing:", health["isSyncing"])
Rust (subxt)
use subxt::{config::substrate::SubstrateConfig, OnlineClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api = OnlineClient::<SubstrateConfig>::from_url(
"wss://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY"
).await?;
let health = api.rpc().system_health().await?;
println!("Peers: {}", health.peers);
println!("isSyncing: {}", health.is_syncing);
println!("shouldHavePeers: {}", health.should_have_peers);
Ok(())
}
Operational Notes
- Collators should alert when
peers
drops to zero orisSyncing
toggles totrue
; both indicate consensus issues. - Combine with
system_version
andstate_getRuntimeVersion
during upgrades to confirm the node is running the expected runtime.