Relayer Services
The Ghost Protocol relies on seven off-chain relayer services managed by PM2. These services handle Merkle tree maintenance, hash computation, proof generation, and testnet faucet operations.
Architecture
Services summary
| Service | Port | Purpose | Public API |
|---|---|---|---|
| Root Updater | 3001 | Updates Merkle roots for CommitmentTree | No (internal) |
| Batch Root Updater | 3030 | Updates roots for 16 sharded trees | No (internal) |
| Open Ghost Root Updater | 3008 | Updates roots for Open Protocol | No (internal) |
| Commitment Relayer | 3002 | Computes Poseidon commitment hashes | Yes (authenticated) |
| Proof Relayer | 3003 | Generates Groth16 ZK proofs | Yes (authenticated) |
| Faucet | 3005 | Distributes testnet GHOST | Yes (public) |
| Stale Monitor | — | Alerts if roots go stale | No (internal) |
Common configuration
All services share these environment variables:
RPC_URL=http://localhost:8545 # Local JSON-RPC
CHAIN_ID=5445 # Specter testnet
Authentication
The commitment relayer and proof relayer require HMAC authentication. Requests must include an X-HMAC-Signature header with a computed signature.
The faucet is publicly accessible with rate limiting.
Rate limits
| Service | Limit |
|---|---|
| Commitment Relayer | 10 requests/minute/IP |
| Proof Relayer | 5 requests/minute/IP |
| Faucet (claim) | 5 requests/minute/IP |
| Faucet (status) | 15 requests/minute/IP |
Process management
All services run under PM2 with auto-restart, memory limits, and health check endpoints.
# View all services
pm2 list
# View logs for a service
pm2 logs ghost-root-updater
# Restart a service
pm2 restart ghost-proof-relayer