L0 Transport
L0: The Wire
Section titled “L0: The Wire”Mission: Move bits from A to B – censorship-free, encrypted, sovereign.
L0 is the foundation of the Libertaria protocol stack. It provides encrypted peer-to-peer transport with no dependency on identity, governance, or economics. Pure physics.
Architecture
Section titled “Architecture”┌─────────────────────────────────────────────────┐│ LWF Wire Protocol (RFC-0000) ││ 88-byte header + payload + 68-byte trailer ││ CRC32-C integrity, Ed25519 signature slot │├─────────────────────────────────────────────────┤│ Noise XX Session Cipher ││ XChaCha20-Poly1305 authenticated encryption ││ Curve25519 ephemeral + static key exchange │├─────────────────────────────────────────────────┤│ DMP (Decentralized Messaging Protocol) ││ MQTT-style pub/sub with wildcards ││ Retained values, will-messages, topic routing │├─────────────────────────────────────────────────┤│ TCP Transport + Dynamic Port Allocation ││ Length-prefixed framing, per-connection buffers ││ SO_REUSEADDR, getsockname() for port 0 │└─────────────────────────────────────────────────┘Proven Capabilities
Section titled “Proven Capabilities”LTP (Libertaria Transport Protocol) is the reference implementation of L0 in Janus :service profile, orchestrating Zig bridges for real networked transport.
Encryption
Section titled “Encryption”- Noise XX Handshake – 3-message key exchange with ephemeral + static Curve25519 keys
- XChaCha20-Poly1305 – Session cipher for all post-handshake frames
- Hop-by-Hop Encrypted Relay – 2-hop DMP relay with independent Noise sessions per TCP link. Relay decrypts, inspects DMP topic for routing, re-encrypts for next hop.
- CRC32 Wire Integrity – Verified at each hop before decryption
Messaging (DMP)
Section titled “Messaging (DMP)”- Topic-Based Pub/Sub – MQTT-style wildcards (
+single-segment,#multi-segment) - Retained Values – Publisher stores last-known value; late-joining subscribers receive it on connect
- Will-Messages – Clients register “last will” on connect. Unclean disconnect (crash, Ctrl+C) fires the will to subscribers. Clean disconnect (goodbye message) clears it.
- Multi-Hop Relay – 2-hop store-and-forward, fan-out hub (1-to-many)
- Lamport Clock – Logical ordering of messages
Mesh Networking
Section titled “Mesh Networking”- 5-Node Ring Topology – Nodes form a ring, each connected to left and right neighbors
- Shortest-Path Routing – Messages route clockwise or counter-clockwise based on hop distance
- Connection Promotion – After successful ring delivery, sender opens direct TCP to destination, bypassing intermediate hops. Ring remains as fallback.
Identity Integration (SBI)
Section titled “Identity Integration (SBI)”- DID-Bound Handshake – Noise XX using X25519 keys derived from SBI identities (Ed25519 + X25519 from deterministic seed via BLAKE3 domain separation)
- Post-Handshake DID Verification – Peers exchange Ed25519 public keys (encrypted), then verify:
BLAKE3(ed25519_pub || noise_remote_static) == expected_DID - CBOR Envelope Encoding – DMP payloads encoded as CBOR maps with Ed25519 signatures, verified at each hop
Wire Format (LWF)
Section titled “Wire Format (LWF)”| Component | Size | Purpose |
|---|---|---|
| Header | 88 bytes | Magic, routing, flow control, metadata, timestamp |
| Payload | 0-9000 bytes | Encrypted or cleartext DMP data |
| Trailer | 68 bytes | Ed25519 signature (64) + CRC32-C checksum (4) |
Frame version: v0x03 (encryption-ready). v0x02 frames are rejected to prevent downgrade attacks.
Bridge Pattern
Section titled “Bridge Pattern”L0 is implemented in Zig for bare-metal performance, exposed to Janus via C-exported handle-based APIs:
Janus (:service) Zig (L0 Bridge)───────────────── ──────────────────extern func l0_new() → Handle pool + mutexframe.l0_encode() → LWF serializationframe.l0_verify() → CRC32-C checkframe.l0_noise_*() → Noise XX + ChaCha20All values are i64 at the FFI boundary. Handle pools are fixed-size arrays with spinlock mutexes. No heap allocation in hot paths.
LRP: Sovereign Routing (RFC-0012)
Section titled “LRP: Sovereign Routing (RFC-0012)”Mission: Route packets through physics, not politics. Replace BGP inside Chapter infrastructure.
LRP is a DAG-based multi-path routing protocol with self-organizing peer discovery. Loops are mathematically impossible (not heuristically prevented). Failover is sub-millisecond (all 4 paths are warm and measured).
Self-Organizing Mesh
Section titled “Self-Organizing Mesh”Three composable protocols enable automatic peer discovery and topology optimization:
| Protocol | Purpose | Academic Lineage |
|---|---|---|
| HyParView | Dual-view peer membership (active + passive) | Leitao et al. 2007 |
| Plumtree | Epidemic broadcast tree (eager/lazy push) | Leitao et al. 2007 |
| X-BOT | QV-aware topology optimization with convergence dampener | Leitao et al. 2009 |
Adaptive Profiles
Section titled “Adaptive Profiles”Nodes auto-detect their operating tier from probe measurements:
| Profile | Active Probe | Active View | DRR Quantum | Use Case |
|---|---|---|---|---|
| Kenya | 500ms | 7 peers | 512 B | Solar-powered, LoRa mesh |
| Standard | 50ms | 15 peers | 1,350 B | Home router, good bandwidth |
| Fiber | 50ms | 30 peers | 4,050 B | Berlin Bitcoin Chapter |
Override levels: Auto (default), Floor (minimum tier), Lock (forced tier). 10-epoch hysteresis + 10% dead zone prevents flapping.
Transport Skin Strategy
Section titled “Transport Skin Strategy”LRP control traffic can be disguised as HTTPS, DNS, or QUIC to evade DPI censorship. Per-interface strategy with automatic fallback probing.
NetSwitch: Packet Processing Orchestrator
Section titled “NetSwitch: Packet Processing Orchestrator”Wires the packet filter (LPF) and routing engine (LRP) into a unified split pipeline:
Frame → LWF magic check → Wire Gate (LPF Ring 0) → TRANSIT: LRP forward to next-hop → LOCAL: deliver to application → DROP: silently discardedDMP: Decentralized Messaging (RFC-0500)
Section titled “DMP: Decentralized Messaging (RFC-0500)”Topic-based pub/sub with MQTT-style wildcards. Now wired into LWF frames (DMP_PUBLISH = 0x0010) for inter-node messaging.
Specifications
Section titled “Specifications”- RFC-0000 – LWF Wire Protocol
- RFC-0010 – UTCP (Micro-LCC keepalives)
- RFC-0012 – Libertaria Routing Protocol (LRP)
- RFC-0015 – Pluggable Transport Skins
- RFC-0016 – Sovereign PKI
- RFC-0020 – OPQ (Opportunistic Path Quality)
- RFC-0500 – LTP Bridge Pattern
Kenya Rule Compliance
Section titled “Kenya Rule Compliance”L0 is designed for intermittent connectivity and resource-constrained devices:
- 88-byte header (fixed, no variable-length encoding overhead)
- Micro-LCC keepalives: 8 bytes (97% reduction vs MQTT PINGREQ)
- Adaptive profiles auto-tune for Kenya hardware (500ms probes, 7 peers, 512B quantum)
- No blockchain dependency at transport layer
- Works over UDP, future: QUIC, mesh radio, WireGuard tunnels