Docs

system_health - Mythos RPC Method

Check node health status on Mythos. Returns peer count, sync status, and connectivity — essential for monitoring, load balancing, and infrastructure management on the gaming blockchain powering FIFA Rivals and NFL Rivals with World ID verification.

Returns the health status of the Mythos node, including peer count, sync state, and whether the node expects to have peers.

Why Mythos? Build on the gaming blockchain powering FIFA Rivals and NFL Rivals with World ID verification with World ID proof-of-humanity, Polkadot security, Snowbridge cross-chain bridge, and 1M+ downloads per title.

When to Use This Method

system_health is essential for game studios, player-driven economy builders, and teams requiring verified human-only gameplay:

  • Health Checks — Monitor node availability and readiness before routing traffic on Mythos
  • Load Balancing — Route requests only to healthy, fully synced nodes for AAA gaming (FIFA Rivals, NFL Rivals, Pudgy Party), player-owned economies, and bot-resistant matchmaking
  • Sync Status — Verify a node is caught up before trusting its state queries
  • Infrastructure Alerts — Trigger alerts when peers drop or sync stalls

Code Examples

Common Use Cases

1. Readiness Probe for Kubernetes

Use as a health check endpoint for container orchestration on Mythos:

JavaScript
import express from 'express';
import { ApiPromise, WsProvider } from '@polkadot/api';

const app = express();
const provider = new WsProvider('wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY');
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 Mythos nodes:

JavaScript
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:

Python
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://api-mythos-archive.n.dwellir.com/YOUR_API_KEY')

Error Handling

Error CodeDescriptionSolution
-32603Internal errorNode may be starting up — retry after delay
-32601Method not foundVerify the node exposes the system RPC module
HTTP 429 / -32029Rate limit exceededReduce polling frequency and retry with backoff
Connection refusedNode is downCheck node process and network connectivity
  • system_version — Get node software version
  • system_chain — Get chain name
  • system_syncState — Get detailed sync progress
  • system_peers — Get detailed peer information