Decisions
ADR-0004 — rust-libp2p for the internet transport
- Status: Accepted
- Date: 2026-07-11
Context
The internet transport needs peer discovery without central servers, NAT traversal (most users are behind NAT/CGNAT), relay capability, and DHT storage for prekey bundles — all as a library, in Rust, embeddable in mobile apps.
Decision
rust-libp2p: QUIC primary / TCP+Noise fallback, Kademlia DHT for discovery and bundle records, AutoNAT + Circuit Relay v2 + DCUtR for NAT traversal.
Alternatives considered
- Custom QUIC + custom DHT: years of re-solving solved problems (NAT traversal alone is a graveyard); zero security benefit since our guarantees don't depend on the transport anyway.
- I2P/Tor as the only transport: strong anonymity but high latency, heavyweight on mobile, and a single ecosystem dependency; adopted instead as an optional transport (M6, arti).
- Nostr-style relay federation: simple, but recreates the server dependency and metadata concentration we exist to avoid.
Consequences
Mature NAT traversal and DHT for free; alignment with a large ecosystem (IPFS, Ethereum use it in production). Costs: non-trivial dependency surface (mitigated: transports are outside the security boundary — they carry sealed envelopes) and libp2p's protocol fingerprint is identifiable to censors (mitigated by M6 obfuscated transports).