Skip to main content

Peer-to-Peer Communication: Carrier

What It Is

Carrier is Elastos's peer-to-peer (P2P) communication layer. It lets devices find each other and exchange messages without routing user data through a single company's servers. That does not mean "no infrastructure anywhere"; it means no central broker that must see plaintext or own the relationship graph for every conversation.

Architecture (High Level)

Carrier stacks application-facing APIs on optional addons (for example Active Proxy and DHT Proxy for relays and bridges), a Kademlia DHT for locating peers and advertised services without a central directory, and encrypted transport keyed to node identities so relays are not expected to see plaintext. For detailed architecture, see Carrier Architecture.

Implementations: C++ and Java

  • C++: The primary native implementation, suitable for mobile, desktop, and embedded targets where performance and binary size matter.
  • Java: A server-oriented variant with practical differences: CBOR encoding instead of the C++ stack's JSON framing in places, a Jetty HTTP server component where applicable, and NaCl-style crypto brought in via TweetNaCl for the Java crypto story.
Porting and debugging

If you compare traces across languages, mismatches often show up as encoding (CBOR vs JSON) or session state differences: not "wrong math," but different wire formats.

Version 1 (Classic): c-toxcore Heritage

Carrier v1 "Classic" was built on a fork of c-toxcore (the same lineage as the Tox encrypted messenger). It emphasized a friend-based social graph, with ICE / STUN / TURN for NAT traversal. That model works well for mutual-contact messaging, but it is narrower than the service-centric, DHT-first design Carrier v2 targets.

The Classic ecosystem spun across multiple repositories; those v1 lines are now deprecated in favor of the current architecture. If you read older posts or forks, expect friend requests and Tox-era assumptions, not the modern DHT + proxy story.

How Carrier Fits the Elastos Stack

Today and near-term:

  • Hive nodes use Carrier for discovery and coordination in decentralized storage scenarios.
  • Essentials (now maintained under the CyberRepublic GitHub) uses Carrier for P2P communication features.
  • Future dApps can treat Carrier as a neutral communication fabric under user-controlled keys, complementary to blockchain consensus and DID-based identity.

Together with DIDs (who you are) and chain consensus (what was agreed globally), Carrier addresses how devices talk, without collapsing that into "every app phones home to one API."

Carrier in the ElastOS Runtime

In the ElastOS Runtime, "Carrier" takes on an additional meaning as the trust enforcement layer -- the middle layer of the runtime's three-layer microkernel design. The Runtime's Carrier layer uses Iroh/QUIC for transport (rather than the classic Kademlia DHT described above), providing capability token enforcement at every cross-capsule boundary, P2P communication via Iroh gossip with mDNS discovery, and signed message exchange using Ed25519 (did:key).

Classic Carrier (Boson, Kademlia DHT, Active Proxy) and Runtime Carrier (Iroh-based trust enforcement) serve different but complementary roles. Classic Carrier provides the decentralized networking substrate; Runtime Carrier provides the trust enforcement layer that uses it for off-box communication.

See the Runtime Architecture for the full three-layer design.