Matrix
Matrix is an open standard for decentralized, real-time communication. It is primarily federated but has active work toward fully P2P operation.
Federation Model
Matrix is natively federated, not purely P2P:
Users belong to homeservers; homeservers replicate room state with each other via the federation API.
Each room is a Merkle DAG of events (messages, state changes), replicated across all participating servers. This DAG structure provides eventual consistency and is conceptually close to State Sync and Content Addressing.
Anyone can run a homeserver, preserving user sovereignty.
End-to-End Encryption
Olm: a double-ratchet protocol (based on Signal protocol) for 1:1 sessions.
Megolm: efficient group encryption for rooms; a single ratchet shared with all participants, much cheaper than pairwise Olm sessions for large rooms.
Key verification via emoji comparison, QR codes, or cross-signing. See Identity and Capabilities.
P2P Matrix
Active research (P2P MSCs – Matrix Spec Change proposals) aims to run Matrix without homeservers:
Embed a homeserver (Dendrite, written in Go) directly in the client application.
Pinecone: an experimental overlay routing protocol using a virtual spanning tree for greedy routing—an alternative to Kademlia DHTs.
P2P Matrix would realize the edge-first pattern for messaging—no server needed, sync when peers are mutually reachable.
Room State Resolution
When concurrent events conflict, Matrix uses a deterministic state resolution algorithm:
State Resolution v2: resolves conflicts by considering event authorization chains and power levels, ensuring all servers converge to the same room state.
This is a domain-specific conflict resolution strategy, an alternative to general CRDTs. It's more expressive (power levels, authorization rules) but less general.
How Matrix Connects to Everything Else
Matrix bridges the federated and P2P worlds. Its DAG-of-events model relates to Content Addressing. Its real-time messaging relates to PubSub. Its encryption addresses Privacy at the message layer. Compliance is relevant as homeserver operators have moderation obligations under laws like the EU Digital Services Act. Security includes room state manipulation and spam from open registration. Storage is a concern as room history grows unboundedly on participating servers.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime