Skip to main content

Rogue Messaging Architecture (rogue-nats-server)

rogue-nats-server is Rogue Signal's decoupled, real-time messaging and agent-coordination server built on embedded NATS + JetStream in Go. It operates independently of rogue-core-chain nodes so community chat, gated miner channels, E2EE direct messages, and AI/CLI agent workflows stay online even if a local blockchain node is stopped or resynchronizing.

Core Design Principles​

  1. Decoupled Centralized Topology (v1): rogue-desktop-client connects directly to the centralized rogue-nats-server via native TCP/TLS (async-nats in Rust on port 4222) without spawning a local NATS daemon. WebSocket (4223) is also exposed for future web clients.
  2. Cryptographic 0x Identity (EIP-191 + Auth Callout): Users and CLI agents prove ownership of their 0x address via single-use 60s challenges signed with secp256k1 (personal_sign). The embedded Auth Callout issues scoped 15-minute NATS JWTs with transparent renewal.
  3. Strict On-Chain Validation: At login and session renewal, the server queries a configured Rogue Signal JSON-RPC endpoint (--rpc-url):
    • eth_getBalance(addr, latest) and eth_getBalance(addr, latest - 120) (lookbackBlocks = 120 ≈ 60 minutes, compatible with standard full nodes without archive mode) to prevent account-hopping spam.
    • eth_call to RogueMinerReputation (0x0000000000000000000000000000000000000020) getMinerLevel(address) for reputation-based permissions.
    • Fail-closed: If the RPC endpoint is unreachable or balance is below the threshold, authentication is strictly rejected.
  4. Gatekeeper Ingress Pattern: Clients only have NATS PUB permissions on rogue.in.<0xAddress>.>. The Go Gatekeeper validates anti-spoofing, room name regex (^[a-z0-9-]{2,32}$), 2000-character limits, https:// link rules, rate limits, and bans/mutes before persisting to JetStream.

Default Tokenomics & Rate-Limit Tiers​

Action / PrivilegeMinimum Requirement (Configurable)Notes
Connect, read & send text>= 1 ROGUE mature (120 blocks)Enforced strictly at Auth Callout & Gatekeeper
Share external https:// links>= 10 ROGUE or MinerLevel >= Lv.1http://, javascript:, data: are blocked
Create public rooms>= 50 ROGUE or MinerLevel >= Lv.2Max 3 rooms per 0x, 1 creation / 5m
Access #hash-wardensMinerLevel >= Lv.3 (Hash Warden)Enforced natively via NATS subject ACLs (rogue.gated.*)
Rate limit (Lv.0 / Lv.1-2 / Lv.3+)6 / 15 / 30 messages per minuteBurst 3 / 5 / 10; Admins bypass limits

Deployment & Operations​

  • Binary: rogue-nats serve --data-dir /var/lib/rogue-nats/data
  • Health & Monitoring: GET /healthz, /varz, /jsz on port 8222
  • Production TLS/WSS: Enable --tls-cert and --tls-key for native TCP/TLS (4222), and use Caddy/Nginx (scripts/Caddyfile.example) for wss:// on port 4223.