system_health - Enjin RPC Method
Check node health status on Enjin. Returns peer count, sync status, and connectivity - essential for monitoring, load balancing, and infrastructure management on the purpose-built NFT blockchain with protocol-level minting and $100M Metaverse Fund.
Enjin RPC endpoint: endpoint URLs, plans and pricing.
Returns the health status of the Enjin node, including peer count, sync state, and whether the node expects to have peers.
Why Enjin? Build on the purpose-built NFT blockchain with protocol-level minting and $100M Metaverse Fund with NFT functions at protocol level, Fuel Tanks for subsidized fees, 700-1000 TPS, 6-second finality, and ERC-1155 standard pioneer.
When to Use This Method
system_health is essential for game developers, NFT creators, and enterprises building cross-chain digital assets:
- Health Checks - Monitor node availability and readiness before routing traffic on Enjin
- Load Balancing - Route requests only to healthy, fully synced nodes for high-volume NFT minting (2,000+ per tx), gaming assets, and cross-chain NFT transfers via Paratoken standard
- Sync Status - Verify a node is caught up before trusting its state queries
- Infrastructure Alerts - Trigger alerts when peers drop or sync stalls
Best Practices
- Call at application startup before processing any transactions
- If
isSyncingistrue, delay all transaction operations until it returnsfalse - Low
peerscount may indicate network connectivity issues - Combine with
system_chainandsystem_versionfor a complete node health check
{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}Code Examples
curl -X POST https://enjin-matrix-rpc.n.dwellir.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}'Common Use Cases
1. Readiness Probe for Kubernetes
Use as a health check endpoint for container orchestration on Enjin:
import express from 'express';
import { ApiPromise, WsProvider } from '@polkadot/api';
const app = express();
const provider = new WsProvider('wss://enjin-matrix-rpc.n.dwellir.com');
const api = await ApiPromise.create({ provider });
app.get('/healthz', async (req, res) => {
try {
const health = await api.rpc.system.health();
const isReady = !health.isSyncing.isTrue && health.peers.toNumber() > 0;
if (isReady) {
res.status(200).json({ status: 'healthy', peers: health.peers.toNumber() });
} else {
res.status(503).json({
status: 'not ready',
syncing: health.isSyncing.isTrue,
peers: health.peers.toNumber()
});
}
} catch (error) {
res.status(503).json({ status: 'unreachable', error: error.message });
}
});2. Multi-Node Load Balancer
Route traffic only to healthy Enjin nodes:
async function selectHealthyNode(endpoints) {
const results = await Promise.allSettled(
endpoints.map(async (endpoint) => {
const response = await fetch(endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'system_health',
params: [],
id: 1
})
});
const { result } = await response.json();
return { endpoint, ...result };
})
);
const healthy = results
.filter(r => r.status === 'fulfilled' && !r.value.isSyncing)
.map(r => r.value)
.sort((a, b) => b.peers - a.peers);
return healthy.length > 0 ? healthy[0].endpoint : null;
}3. Continuous Health Monitor
Periodically check node health and alert on degradation:
import requests
import time
def monitor_health(endpoint, interval=30, min_peers=5):
while True:
try:
payload = {
'jsonrpc': '2.0',
'method': 'system_health',
'params': [],
'id': 1
}
response = requests.post(endpoint, json=payload, timeout=5)
health = response.json()['result']
peers = health['peers']
syncing = health['isSyncing']
if syncing:
print(f'WARNING: Node is syncing (peers: {peers})')
elif peers < min_peers:
print(f'WARNING: Low peer count: {peers}')
else:
print(f'OK: peers={peers}, syncing={syncing}')
except Exception as e:
print(f'ERROR: Node unreachable - {e}')
time.sleep(interval)
monitor_health('https://enjin-matrix-rpc.n.dwellir.com')Error Handling
| Error Code | Description | Solution |
|---|---|---|
| -32603 | Internal error | Node may be starting up - retry after delay |
| -32601 | Method not found | Verify the node exposes the system RPC module |
| HTTP 429 / -32029 | Rate limit exceeded | Reduce polling frequency and retry with backoff |
| Connection refused | Node is down | Check node process and network connectivity |
Related Methods
system_version- Get node software versionsystem_chain- Get chain namesystem_syncState- Get detailed sync progresssystem_peers- Get detailed peer information
state_queryStorageAt
Batch query multiple storage keys at a specific block on Enjin. Efficiently retrieve consistent multi-key state snapshots for indexers, dashboards, and analytics.
system_chain
Get the chain name on Enjin. Essential for network identification, multi-chain applications, and verifying the correct network connection.