DEV Community

Michael Muriithi
Michael Muriithi

Posted on

Building a Decentralized Mesh Network in Rust: GhostWire

Building a Decentralized Mesh Network in Rust: GhostWire

GhostWire is an open protocol and reference implementation for resilient peer-to-peer communication. It is built in Rust with libp2p, XChaCha20-Poly1305, X25519/ML-KEM hybrid post-quantum key exchange, delay-tolerant networking, and AI-assisted routing.

Why GhostWire exists

Most communication systems assume a working internet, centralized servers, and stable identities. GhostWire assumes the opposite: intermittent connectivity, untrusted infrastructure, and real physical threats. It is built for disaster responders, rural communities, privacy advocates, and developers who need communication that still works when the normal stack fails.

What works today

  • Encrypted P2P messaging over libp2p
  • Forward secrecy with a symmetric ratchet
  • Peer discovery with mDNS, DHT, and bootstrap peers
  • Delay-tolerant store-carry-forward routing
  • Post-quantum key encapsulation (ML-KEM)
  • Terminal UI and Axum-based REST API
  • 200+ passing tests

Protocol stack

Application: messaging, knowledge ark, ghost channels
API: REST, WebSocket, CLI, TUI
Services: block store, mailbox, social, Sphinx
AI routing: LightGBM -> Gemma 4 -> GNN -> PRoPHET
Crypto: XChaCha20-Poly1305, X25519, ML-KEM-768
Transports: TCP, WebRTC, BLE, LoRa, obfs4, Reticulum
Mesh: libp2p GossipSub, Kademlia DHT, DTN
Enter fullscreen mode Exit fullscreen mode

Quick start

git clone https://codeberg.org/PHANTOMOJO/GhostWire-secure-mesh-communication.git
cd GhostWire-secure-mesh-communication/ghostwire
cargo run --release
Enter fullscreen mode Exit fullscreen mode

The node starts on http://127.0.0.1:8080. Mesh networking activates with --mesh-port.

Build on it

GhostWire is a protocol, not just an app. Use it as a Rust crate, REST API, or implement the spec in another language.

Read the spec: docs/spec/
GitHub/Codeberg: https://codeberg.org/PHANTOMOJO/GhostWire-secure-mesh-communication
Website: https://www.ghostwire.cc/

Contribute

We welcome code, tests, docs, security review, and field testing. Good first issues and help-wanted labels are being prepared now. If you work on mesh networking, privacy, DTN, or Rust crypto, your review would help.

Top comments (0)