Skip to content

L0 Transport

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.

┌─────────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────────┘

LTP (Libertaria Transport Protocol) is the reference implementation of L0 in Janus :service profile, orchestrating Zig bridges for real networked transport.

  • 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
  • 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
  • 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.
  • 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
ComponentSizePurpose
Header88 bytesMagic, routing, flow control, metadata, timestamp
Payload0-9000 bytesEncrypted or cleartext DMP data
Trailer68 bytesEd25519 signature (64) + CRC32-C checksum (4)

Frame version: v0x03 (encryption-ready). v0x02 frames are rejected to prevent downgrade attacks.

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 + mutex
frame.l0_encode() → LWF serialization
frame.l0_verify() → CRC32-C check
frame.l0_noise_*() → Noise XX + ChaCha20

All values are i64 at the FFI boundary. Handle pools are fixed-size arrays with spinlock mutexes. No heap allocation in hot paths.

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).

Three composable protocols enable automatic peer discovery and topology optimization:

ProtocolPurposeAcademic Lineage
HyParViewDual-view peer membership (active + passive)Leitao et al. 2007
PlumtreeEpidemic broadcast tree (eager/lazy push)Leitao et al. 2007
X-BOTQV-aware topology optimization with convergence dampenerLeitao et al. 2009

Nodes auto-detect their operating tier from probe measurements:

ProfileActive ProbeActive ViewDRR QuantumUse Case
Kenya500ms7 peers512 BSolar-powered, LoRa mesh
Standard50ms15 peers1,350 BHome router, good bandwidth
Fiber50ms30 peers4,050 BBerlin Bitcoin Chapter

Override levels: Auto (default), Floor (minimum tier), Lock (forced tier). 10-epoch hysteresis + 10% dead zone prevents flapping.

LRP control traffic can be disguised as HTTPS, DNS, or QUIC to evade DPI censorship. Per-interface strategy with automatic fallback probing.

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 discarded

Topic-based pub/sub with MQTT-style wildcards. Now wired into LWF frames (DMP_PUBLISH = 0x0010) for inter-node messaging.

  • 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

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