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:
v:1relay_id: self-certifyingftx_<20-crockford-b32>derived frommicrolog[0](pow_bits >= 22).tier:"seed"(official backbone) or"community"(verified independent operator).operator:{"contact": "https://...", "name": "..."}.region: geographic routing tag (e.g.,"us-east","eu-central","ap-northeast").endpoints:{"udp": "host:port", "wss": "wss://.../v4/relay"}(with optional"http": "https://...").capabilities: subset of["bootstrap", "dropbox", "ws_relay", "topic_gossip"].limits:{"max_dropbox_ttl_sec": 604800, "max_frame_bytes": 65536, "ring_quota_per_window": 30, "ring_window_sec": 600}.microlog: verified genesis/rotation chain establishing currentpk_id(32 B) andek_kem(1216 B).issued_at,expires_at: Unix seconds (expires_at > issued_at).operator_sig: Base64ristretto255Schnorr signature (64 B) by currentpk_idover"fatext-v4-relay-manifest\n" || JCS(manifest_without_operator_sig).
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
- Cold-Key Signature Check: Verify
relays.json.sigover"fatext-v4-relays-registry\n" || relays_json_bytesagainst the client's pinnedEd25519public key (official_release_key_fp). - Static Transparency Hash-Chain,
C2SPWitness Quorum & Split-View Equivocation Enforcement: Each epoch commits toprev_registry_hash(00..00atepoch=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-keyentry_sig("fatext-v4-registry-entry\n" || registry_hash), and a2-of-3threshold of independent C2SPtlog-witness/tlog-cosignature-inspiredEd25519cosignatures (witness_cosigsover"fatext-v4-witness-cosig\n" || epoch || "\n" || registry_hash, tagged bywitness_id), published alongside/.well-known/relays-chain.json(.sig). Clients reject any epoch lacking>= 2valid 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-signedregistry_hashat the sameepoch(EXIT_EQUIVOCATION = 9). - Live Handshake Key Binding (
GET /v4/status/WSS /v4/relay): Upon connecting, the client sends a random 32-bytechallenge(?challenge=<hex>); the relay must sign"fatext-v4-relay-hello\n" || relay_id || "\n" || challenge || "\n" || tsusing thepk_idfrom its registeredmicrolog(while also reflecting the caller's NAT-mappedobserved_addr). DNS hijacking or rogue TLS proxies fail immediately (EXIT_CRYPTO = 8).
3. PoW-Gated & Subnet-Diverse 256-Bit Kademlia DHT
- Node Keyspace:
node_key = SHA3-256("fatext-v4-dht-node\n" || agent_id)(256 bits), distance d(A, B) = A ⊕ B. - Pinned Backbone,
/24&/48Eclipse Guard + Disjoint Lookups: Following S/Kademlia and IPFS Kademlia Sybil & Eclipse Defenses (2025), clients pin active registered public relays, require>= 22-bitGenesis PoW for unpinned--seedpeers, cap unpinned candidate seeds to at most1node per IPv4/24or IPv6/48prefix (fatext dht filter-eclipse), and execute 3 node-disjoint iterative lookups (α = 3, k = 20). - Signed DHT Records:
ReachDescriptor(SHA3-256("reach\n" || agent_id), max8 KB, TTL1800 s): carriesmicrolog, latestek_kem, direct UDP endpoints, and1..3home Drop-Box relay IDs/URLs.RevokeTombstone(SHA3-256("tomb\n" || agent_id), max2 KB, TTL365 d): carries terminalrevokeevent or equivocation fraud proof.TopicProvider(SHA3-256("topic\n" || topic), max4 KB, TTL3600 s): lists relays caching content-addressed topic messages.
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:
- Fail-Closed PoW Floor (
min_pow_bits >= 22):/v4/ring-pool/admit, DHT admission, and S2S identity verification requirepow_bits >= min_pow_bits(22default; lower values allowed only explicitly in isolated test harnesses). - 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) orScoped bLSAGquota proof (HTTP 401if unauthenticated) and are throttled by configurable--opk-claim-limitquotas (HTTP 429 ERR_RATE_LIMITED), preventing anonymous prekey depletion DoS. - 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-fedfor local integration tests. - Homeserver Discovery (
/.well-known/fatext-homeserver.json&/v4/kt/head): Homeservers publishmode(official|selfhosted),public_url,min_pow_bits, capability flags, non-wallet commercial posture, and signed Key Transparency chain heads.