HA RelayMiner

Info

This page covers the pocket-relay-miner — a separate codebase from the standard poktroll RelayMiner. Use this for production deployments requiring horizontal scaling, high availability, and multi-transport support. For the standard single-instance RelayMiner, see RelayMiner Setup.

The HA RelayMiner is a production-grade, horizontally scalable relay mining service for Pocket Network. It uses Redis for all session state — no local disk storage — enabling multiple replicas behind a load balancer.

Architecture

plaintext
              ┌──────────────┐
Requests ───→ │   Relayer    │ ───→ Backend Nodes
              │ (stateless)  │
              └──────┬───────┘
                     │ Redis Streams
              ┌──────┴───────┐
              │    Miner     │ ───→ Blockchain (claims/proofs)
              │  (stateful)  │
              └──────────────┘

Critical Components

ComponentDirectoryPurpose
Relayerrelayer/Stateless multi-transport proxy. Validates requests, signs responses, publishes to Redis Streams.
Minerminer/Stateful claim/proof submission with leader election. Consumes from Redis Streams, builds SMST trees.
Cachecache/Three-tier caching (L1 local → L2 Redis → L3 chain) with pub/sub invalidation.
Ringsrings/Ring signature verification for relay request authentication.

Supported Transports

TransportRPC Type IDProtocol
JSON-RPC3Standard HTTP POST
WebSocket2Bidirectional, subscription support
gRPC1High-performance binary protocol
REST/SSE4Cosmos SDK REST, server-sent events
CometBFT5CometBFT-specific RPC

Performance

MetricValue
Throughput (local)1,182 RPS (Docker)
Throughput (production)1,500–2,000 RPS (dedicated hardware)
Relay latency (p50)1.33ms
Relay latency (p95)2.67ms
Relay latency (p99)26.19ms
Validation overhead<1ms (ring signature + session)
SMST operations~30µs per Redis Hash operation
L1 cache hit<100ns (lock-free concurrent map)
L2 cache hit<2ms (Redis with connection pooling)

Redis Architecture

All session state lives in Redis. No local disk storage.

Key Patterns

PatternTypeContents
ha:relays:{supplier}StreamWrite-ahead log of relays
ha:smst:{session}:nodesHashSparse Merkle Sum Trie nodes
ha:miner:sessions:{supplier}:{session}StringSession metadata (JSON)
ha:cache:application:{address}StringCached application data (proto)
ha:miner:global_leaderStringLeader election lock (TTL 30s)
ha:tx:track:{supplier}:{height}:{session}StringSubmission tracking (7-day TTL)

Leader Election

Only one Miner instance submits claims and proofs at a time. The leader holds a Redis lock (ha:miner:global_leader) with a 30-second TTL, refreshed continuously. If the leader fails, another instance acquires the lock automatically.

Configuration

The HA RelayMiner uses two config files:

Relayer Config (config.relayer.yaml)

yaml
relayer:
  listen_address: ":8080"
  health_address: ":8081"
  metrics_address: ":9090"
  redis:
    address: "redis:6379"
  backends:
    eth:
      url: "http://your-eth-node:8545"
    solana:
      url: "http://your-solana-node:8899"
  supplier_keys:
    - address: "pokt1supplier..."
      private_key_hex: "..."

Miner Config (config.miner.yaml)

yaml
miner:
  redis:
    address: "redis:6379"
  chain:
    rpc_url: "https://sauron-rpc.infra.pocket.network"
    grpc_address: "sauron-grpc.infra.pocket.network:443"
  metrics_address: ":9092"

Ports Reference

PortServicePurpose
8080Relayer HTTPRelay request ingress
8081Relayer healthHealth/readiness probes
9090Relayer metricsPrometheus metrics
9092Miner metricsMiner-specific metrics
6060pprofGo profiling (debug builds)

When to Use HA vs Standard RelayMiner

FactorStandard RelayMinerHA RelayMiner
ScaleSingle instanceMultiple replicas
StateLocalRedis (shared)
FailoverManualAutomatic (leader election)
TransportsJSON-RPCJSON-RPC, WebSocket, gRPC, REST, SSE
Best forSmall operators, getting startedProduction, high-volume, SLA requirements
DependencyNoneRedis
Warning

Keep your node wallet funded with liquid POKT. Claim and proof submissions are on-chain transactions that cost fees. If the Miner can’t pay fees, rewards for that session are lost.

Repository

github.com/pokt-network/pocket-relay-miner