Health & Stats API

System endpoints for monitoring node status and network statistics.

Health Check

GET /api/health

Returns the node's current status.

Response

{
  "status": "ok",
  "chain_id": "rougechain-devnet-1",
  "height": 12345
}
FieldTypeDescription
statusstring"ok" if the node is healthy
chain_idstringThe chain identifier
heightnumberCurrent block height

Use Cases

  • Monitoring node uptime
  • Checking sync status (compare height with peers)
  • Load balancer health checks

Network Statistics

GET /api/stats

Returns network-wide statistics.

Response

{
  "connected_peers": 3,
  "network_height": 12345,
  "is_mining": true,
  "node_id": "abc123...",
  "total_fees_collected": 1234.5,
  "fees_in_last_block": 0.6,
  "chain_id": "rougechain-devnet-1",
  "finalized_height": 12300,
  "ws_clients": 12,
  "node_name": "node-1",
  "base_fee": 0.001,
  "total_fees_burned": 5000.0
}
FieldTypeDescription
connected_peersnumberCurrently connected peers
network_heightnumberCurrent block height
is_miningbooleanWhether this node is mining
node_idstringThis node's ID
total_fees_collectednumberTotal fees collected
fees_in_last_blocknumberFees collected in the last block
chain_idstringChain identifier
finalized_heightnumberLast finalized block height
ws_clientsnumberActive WebSocket clients
node_namestring | nullHuman-readable node name (optional)
base_feenumberCurrent EIP-1559 base fee
total_fees_burnednumberTotal fees (base fee) burned

Burn Stats

GET /api/burned

Get burned token statistics.

Response

{
  "burned": {
    "XRGE": 5000.0,
    "qETH": 1.5
  },
  "total_xrge_burned": 5000.0
}
FieldTypeDescription
burnedobjectPer-token burned totals, keyed by token symbol
total_xrge_burnednumberTotal XRGE burned

Examples

Monitoring Script

#!/bin/bash
while true; do
  HEIGHT=$(curl -s http://127.0.0.1:5100/api/health | jq '.height')
  echo "$(date): Block height = $HEIGHT"
  sleep 10
done

Compare with Testnet

LOCAL=$(curl -s http://127.0.0.1:5100/api/health | jq '.height')
TESTNET=$(curl -s https://testnet.rougechain.io/api/health | jq '.height')
echo "Local: $LOCAL, Testnet: $TESTNET, Behind: $((TESTNET - LOCAL))"