system_health - JSON-RPC Method
Description
Returns basic health telemetry from an Enjin Matrix node including whether it is syncing, the number of peers it is connected to, and whether it expects to have peers. This call is lightweight and safe to poll for infrastructure monitoring.
Parameters
This method does not take any parameters.
Returns
Field | Type | Description |
---|---|---|
peers | number | Number of peers currently connected |
isSyncing | boolean | Indicates if the node is still catching up |
shouldHavePeers | boolean | Whether the node configuration requires peers |
Request Example
{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}
Response Example
{
"jsonrpc": "2.0",
"result": {
"peers": 21,
"isSyncing": false,
"shouldHavePeers": true
},
"id": 1
}
Code Examples
cURL
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}'
JavaScript (Node.js)
async function checkHealth() {
const response = await fetch('https://api-enjin-matrixchain.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();
console.log(`Peers: ${result.peers}`);
console.log(`Syncing: ${result.isSyncing}`);
}
Python (requests)
import json
import requests
payload = {
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1,
}
health = requests.post(
"https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload),
timeout=10,
).json()["result"]
print(f"Peers: {health['peers']} | Syncing: {health['isSyncing']}")
Monitoring Tips
- Set alerts if
isSyncing
flips totrue
for production nodes to catch stalled peers early. - Track
peers
over time to validate network connectivity after redeployments or firewall changes. - Combine with
system_syncState
for more granular progress reporting during initial syncs.