Lightweight MQTT-based secure P2P messaging layer
Project description
sidewire
Part of the Warpgate project: https://www.warpgate.io/
A decentralized MQTT-based signaling layer for P2P applications.
sidewire routes messages between peers using rendezvous hashing over a shared pool of public MQTT brokers. Neither side needs to know which servers the other is connected to — the shared key deterministically produces the same server ordering on both ends.
Key concepts
- Router — connects to MQTT brokers, sends and receives signed messages keyed by public key hex. Supports caching of peer-to-server mappings to avoid repeated discovery.
- SmartPipe — a virtual pipe over multiple MQTT clients that automatically routes a message to the first broker where both peers are connected.
- AppPacket — wire-format envelope for signed P2P messages. Includes a per-queue sequence number for ordered delivery, a message type field, and an ECDSA signature over the payload.
- MQTTClient — low-level async MQTT client. Handles subscribe/publish, PUBACK sequencing, and reconnect.
Usage
from aionetiface import Interface
from sidewire import Router
from sidewire.utils import get_mqtt_server_list
from aionetiface.net.signing import Signing
nic = Interface("default")
kp = Signing.keypair()
async def on_message(msg, src_pk_hex, pipe_id_hex, client):
print("received:", msg, "from", src_pk_hex)
async with Router(kp, msg_handler=on_message, nic=nic) as router:
pipe = await router.pipe(dest_pub_key_hex)
await pipe.send("hello")
Server selection algorithm
Servers are ranked per destination key using the rendezvous hashing formula
-log(H(server_id || key)) / weight. IPv4 and IPv6 results are interleaved so
convergence is possible even when peers support different address families.
Installation
pip install sidewire
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sidewire-0.1.5.tar.gz.
File metadata
- Download URL: sidewire-0.1.5.tar.gz
- Upload date:
- Size: 41.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23a3b314d965a5c30eabba28b79631de8c12585eb8e27b30418b0aab82073e94
|
|
| MD5 |
d86653079fd610955d061c10f2370007
|
|
| BLAKE2b-256 |
2a05407d2ca866cdac944f59608a3ab2bfd0388eb9dcea1e59f94f6ef236c649
|