p2p-mes Protocol Documentation
p2p-mes is a peer-to-peer messenger built on libp2p (GossipSub for
messaging, Kademlia for discovery), RocksDB storage, and ECDSA / Keccak256
signature-based authentication. Every node stores all data and reconciles with
its peers through Merkle-tree anti-entropy synchronization.
This site is the protocol reference: it describes the wire formats, the cryptography, and everything a third party needs to build an interoperable client. It is generated from the Markdown files maintained alongside the code, so the documentation and the implementation never drift apart.
Where to start
- Building a client? Read Building a Client and the API Reference. The ~13 HTTP endpoints are the entire client-facing surface -- you do not need the gossip or sync internals to build an interoperable client.
- Implementing or operating a node? Read the Protocol Specification and Internals sections, which describe the node-to-node mechanics.
How this documentation is organized
- Philosophy & Design -- the principles behind the protocol: why state is minimized, why every node replicates everything, and the two-layer (transport vs. client) split.
- Protocol Specification -- the normative wire reference: the gossip message set and its CBOR encoding, the anti-entropy sync state machine, and the cryptographic primitives.
- Client Implementation -- a practical, end-to-end guide to building a client: request signing, the message lifecycle, pagination, and the opaque Layer-2 fields used for end-to-end encryption.
- HTTP API -- the REST surface, with an interactive reference generated from the server's OpenAPI specification.
- Internals -- architecture, storage layout, shared types, retention, and testing -- aimed at contributors to the node itself.
Conventions
Fixed identifier lengths are load-bearing throughout the protocol: user addresses are 20 bytes, while chat and message identifiers are 32 bytes. Multi-byte integers embedded in storage keys are big-endian. All persistent data is syncable between nodes.