reticulum-kt

March 26, 2026 ยท View on GitHub

Conformance

A Kotlin/JVM implementation of the Reticulum Network Stack for building resilient, delay-tolerant mesh networks on Android and JVM.

Implementation Status

Comparison with Python RNS reference implementation. Interoperability is validated by automated tests against the Python reference.

Core Protocol

ComponentStatusNotes
IdentityCompleteX25519/Ed25519, ratchets, known destinations, persistent storage
DestinationCompleteAll types (SINGLE, GROUP, PLAIN, LINK), request handlers, proof strategies
PacketCompleteFull wire format, HEADER_1/HEADER_2, receipts, proofs
Transport~95%Routing, path management, tunnels, announces, announce caching, link management, IFAC, mode-based filtering
LinkCompleteEstablishment, encryption, channels, resources, request/response, MTU discovery
Channel~90%Windowed flow control, ordered delivery, retransmission, message type registry
BufferCompleteStream I/O over channels
Resource~90%Chunked transfer, BZ2 compression, progress tracking, metadata
CryptoCompleteBouncyCastle: X25519, Ed25519, HKDF, AES-256-CBC, SHA-256/512

Interfaces

InterfaceStatusNotes
TCP Server/ClientCompleteHDLC framing, exponential backoff reconnect
UDPCompleteUnicast, broadcast, multicast
Local (Shared Instance)CompleteServer/client IPC for sharing Reticulum across apps
RNode (LoRa)CompleteFull KISS protocol, firmware checking, BLE + serial transport
BLE MeshCompleteDual-role GATT, identity handshake, fragmentation, Android driver
Auto (Discovery)CompleteIPv6 multicast peer discovery, per-peer UDP connections
KISS FramingCompleteUsed by TCP and RNode interfaces
HDLC FramingCompleteUsed by TCP interfaces
I2PNot implementedStub in config factory
SerialNot implementedRNode covers most serial use cases

Android

ComponentStatusNotes
Foreground ServiceCompletePersistent connection with Doze/battery awareness
BLE DriverCompleteGATT server/client, advertising, scanning (API 26+)
Power ManagementCompleteDoze handler, battery monitor, WorkManager integration
Sample AppMovedSee carina for the Compose UI sample app
LXMFMovedSee LXMF-kt for the LXMF messaging protocol

Remaining Work

Features that exist in the Python reference but are not yet implemented:

FeaturePriorityDescription
PHY stats on packetsMediumExpose RSSI/SNR/Q from RNode through the Packet API
Interface discoveryMediumInterfaceAnnouncer/InterfaceMonitor for mDNS-based interface discovery
Blackhole systemMediumIdentity blacklisting to block bad actors
Remote managementLowControl destinations for remote /path and /status queries
RPC serverLowMulti-process sharing of a single Reticulum instance
CLI utilitiesLowrnstatus, rnpath, rnprobe equivalents
SerialInterfaceLowDirect serial port (RNode covers most use cases)
I2PInterfaceLowI2P anonymity network integration

Utilities/CLI

ToolStatusNotes
rnsd-ktCompleteDaemon matching Python rnsd behavior
rnstatusNot startedNetwork status
rnpathNot startedPath discovery
rnprobeNot startedPing/latency

Requirements

  • JDK 21+
  • Python 3.8+ with RNS installed (for interop tests)
  • Android API 26+ (for Android deployment)

Project Structure

rns-core/        # Core protocol (Identity, Destination, Transport, Link, Channel, Resource)
rns-interfaces/  # Network interfaces (TCP, UDP, Local, RNode, BLE, Auto)
rns-android/     # Android-specific code (BLE driver, foreground service, power management)
rns-cli/         # CLI utilities (rnsd-kt daemon)
rns-test/        # Integration and interop tests
python-bridge/   # Python bridge server for interop testing (120+ commands)

Building

./gradlew build

Running Tests

Run all tests:

./gradlew test

Run only interop tests (requires Python RNS):

./gradlew test --tests "*InteropTest*"

Run a specific test class:

./gradlew test --tests "network.reticulum.interop.identity.IdentityInteropTest"

Running rnsd-kt

Build the fat JAR:

./gradlew :rns-cli:shadowJar

Run the daemon:

java -jar rns-cli/build/libs/rnsd-kt.jar

CLI options (matching Python rnsd):

Options:
  --config PATH     Path to config directory (default: ~/.reticulum)
  -v, --verbose     Increase verbosity (repeatable)
  -q, --quiet       Decrease verbosity (repeatable)
  -s, --service     Run as service (log to file)
  --exampleconfig   Print example config and exit
  --version         Show version and exit
  -h, --help        Show this message and exit

Usage

import network.reticulum.Reticulum
import network.reticulum.identity.Identity
import network.reticulum.destination.Destination
import network.reticulum.common.DestinationDirection
import network.reticulum.common.DestinationType

// Initialize Reticulum
val rns = Reticulum.start()

// Create an identity
val identity = Identity.create()

// Create a destination
val destination = Destination.create(
    identity = identity,
    direction = DestinationDirection.IN,
    type = DestinationType.SINGLE,
    appName = "myapp",
    "example"
)

// Register and announce
rns.registerDestination(destination)
destination.announce()

// Cleanup
Reticulum.stop()

Interop Testing

The test suite validates byte-perfect compatibility with Python RNS. The Python bridge server (python-bridge/bridge_server.py) provides 120+ commands for cross-implementation verification covering crypto, packet formats, link encryption, channel messaging, resource transfer, and LXMF message exchange.

Tests are started automatically - no manual setup required.

License

MPL-2.0