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.

  • RFC-0000 – LWF Wire Protocol
  • RFC-0010 – UTCP (Micro-LCC keepalives)
  • 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)
  • No blockchain dependency at transport layer
  • Works over TCP, future: UDP, QUIC, mesh radio