fatext v4.0
fatext / specs / 04-relay-registry-and-dht

04 — Signed Public Relay Registry & Kademlia DHT Discovery

fatext v4.0 solves decentralized cold-start and Sybil/Eclipse routing attacks by combining a GitOps-curated, cold-key-signed static Public Relay Registry (/.well-known/relays.json) with a PoW-admitted 256-bit Kademlia DHT.

1. Operator Relay Manifest (registry/relays/<relay_id>.json)

Any operator running fatext daemon --seed generates a self-signed manifest via fatext relay manifest:

2. Static Aggregated Registry (/.well-known/relays.json + .sig)

scripts/build_site.py validates every manifest via verify_relay_registry.py, excludes any ID listed in registry/revoked.json, emits deterministic JCS-ordered JSON with monotonically increasing registry_epoch, and signs domain-separated file payloads using the official offline RFC 8032 Ed25519 release key (relays.json.sig signs "fatext-v4-relays-registry\n" || exact_file_bytes, relays-chain.json.sig signs "fatext-v4-relays-chain\n" || exact_file_bytes, and SHA256SUMS.sig signs "fatext-v4-release-sums\n" || exact_file_bytes, each encoded as Base64 64-byte signatures).

Bootstrap vs. Production Keys: Repository builds default to deterministic dev/bootstrap seeds for reproducible CI and cross-repo verification. Production publication MUST run with --production, an air-gapped cold release key (FATEXT_OFFICIAL_KEY_SEED_HEX / --seed-file), and independently collected witness cosignatures (--witness-cosigs-file).

Three-Step Client Verification Contract

  1. Cold-Key Signature Check: Verify relays.json.sig over "fatext-v4-relays-registry\n" || relays_json_bytes against the client's pinned Ed25519 public key (official_release_key_fp).
  2. Static Transparency Hash-Chain, C2SP Witness Quorum & Split-View Equivocation Enforcement: Each epoch commits to prev_registry_hash (00..00 at epoch=1), state_hash = SHA3-256("fatext-v4-registry-state\n" || sorted_active_bindings || "\n" || sorted_revoked_ids), registry_hash = SHA3-256("fatext-v4-registry-link\n" || epoch || "\n" || prev_registry_hash || "\n" || state_hash || "\n" || op_summary || "\n" || generated_at), cold-key entry_sig ("fatext-v4-registry-entry\n" || registry_hash), and a 2-of-3 threshold of independent C2SP tlog-witness / tlog-cosignature-inspired Ed25519 cosignatures (witness_cosigs over "fatext-v4-witness-cosig\n" || epoch || "\n" || registry_hash, tagged by witness_id), published alongside /.well-known/relays-chain.json (.sig). Clients reject any epoch lacking >= 2 valid pinned witness cosignatures (ERR_WITNESS_QUORUM, EXIT_CRYPTO = 8) even on network-eclipsed first boot, verify unbroken hash continuity from their pinned (epoch, registry_hash), and immediately freeze on any conflicting cold-key-signed registry_hash at the same epoch (EXIT_EQUIVOCATION = 9).
  3. Live Handshake Key Binding (GET /v4/status / WSS /v4/relay): Upon connecting, the client sends a random 32-byte challenge (?challenge=<hex>); the relay must sign "fatext-v4-relay-hello\n" || relay_id || "\n" || challenge || "\n" || ts using the pk_id from its registered microlog (while also reflecting the caller's NAT-mapped observed_addr). DNS hijacking or rogue TLS proxies fail immediately (EXIT_CRYPTO = 8).

3. PoW-Gated & Subnet-Diverse 256-Bit Kademlia DHT

4. v4.1 Homeserver Discovery & Relay Hardening Rules

Homeservers launched with fatext daemon --homeserver layer the following operational hardening on top of public relay and DHT endpoints:

  1. Fail-Closed PoW Floor (min_pow_bits >= 22): /v4/ring-pool/admit, DHT admission, and S2S identity verification require pow_bits >= min_pow_bits (22 default; lower values allowed only explicitly in isolated test harnesses).
  2. Authenticated & Rate-Limited OPK Claims (POST /v4/prekeys/{agent_id}/claim): Callers must authenticate via signed HTTP headers (fatext-v4-http\n + X-Microlog-B64) or Scoped bLSAG quota proof (HTTP 401 if unauthenticated) and are throttled by configurable --opk-claim-limit quotas (HTTP 429 ERR_RATE_LIMITED), preventing anonymous prekey depletion DoS.
  3. Outbound SSRF Isolation (/v4/onion & /v4/federation/*): Homeservers forbid credentials in URLs (user:pass@), disallow obfuscated IP literals, resolve hostnames via system DNS before dialing, and block loopback (127.0.0.0/8, ::1), RFC1918, link-local (169.254.0.0/16, fe80::/10), and IPv6 ULA (fc00::/7) targets (HTTP 403 ERR_SSRF_BLOCKED) unless explicitly started with --allow-local-fed for local integration tests.
  4. Homeserver Discovery (/.well-known/fatext-homeserver.json & /v4/kt/head): Homeservers publish mode (official | selfhosted), public_url, min_pow_bits, capability flags, non-wallet commercial posture, and signed Key Transparency chain heads.
Raw Markdown: /specs/04-relay-registry-and-dht.md All specs & proofs: /llms-full.txt