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
- Decoupled Centralized Topology (v1):
rogue-desktop-clientconnects directly to the centralizedrogue-nats-servervia native TCP/TLS (async-natsin Rust on port4222) without spawning a local NATS daemon. WebSocket (4223) is also exposed for future web clients. - Cryptographic
0xIdentity (EIP-191 + Auth Callout): Users and CLI agents prove ownership of their0xaddress via single-use60schallenges signed withsecp256k1(personal_sign). The embedded Auth Callout issues scoped15-minuteNATS JWTs with transparent renewal. - 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)andeth_getBalance(addr, latest - 120)(lookbackBlocks = 120≈ 60 minutes, compatible with standard full nodes without archive mode) to prevent account-hopping spam.eth_calltoRogueMinerReputation(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.
- Gatekeeper Ingress Pattern: Clients only have NATS
PUBpermissions onrogue.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 / Privilege | Minimum 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.1 | http://, javascript:, data: are blocked |
| Create public rooms | >= 50 ROGUE or MinerLevel >= Lv.2 | Max 3 rooms per 0x, 1 creation / 5m |
Access #hash-wardens | MinerLevel >= 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 minute | Burst 3 / 5 / 10; Admins bypass limits |
Deployment & Operations
- Binary:
rogue-nats serve --data-dir /var/lib/rogue-nats/data - Health & Monitoring:
GET /healthz,/varz,/jszon port8222 - Production TLS/WSS: Enable
--tls-certand--tls-keyfor native TCP/TLS (4222), and use Caddy/Nginx (scripts/Caddyfile.example) forwss://on port4223.