Networking
libp2p host, gossip, sync, and direct messaging
XE is a fully peer-to-peer network with no central servers. All node communication -- block propagation, consensus voting, synchronization, marketplace negotiation, and peer discovery -- happens over direct connections between nodes using libp2p.
Components
Component
Purpose
Protocol / Mechanism
TCP transport, connection management, persistent identity
libp2p core
Broadcast blocks, votes, marketplace, statechain, directory
libp2p GossipSub
Frontier-based block synchronization
/xe/sync/1.0.0 stream
Request-response over streams
/xe/msg/1.0.0 stream
DHT
Kademlia peer discovery
/xe prefixed DHT
Architecture Overview
┌──────────────────────────────────────────────────────────┐
│ Node │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ Ledger │ │ State Chain │ │ Directory │ │
│ └──────┬──────┘ └──────┬──────┘ └───────┬─────────┘ │
│ │ │ │ │
│ ┌──────┴────────────────┴──────────────────┴─────────┐ │
│ │ Network Layer (net package) │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────┐ ┌──────────┐ ┌───────────┐ │ │
│ │ │ GossipSub│ │ Sync │ │Messenger │ │ DHT │ │ │
│ │ └────┬─────┘ └──┬───┘ └────┬─────┘ └─────┬─────┘ │ │
│ └───────┼──────────┼──────────┼──────────────┼───────┘ │
│ │ │ │ │ │
│ ┌───────┴──────────┴──────────┴──────────────┴───────┐ │
│ │ libp2p Host (TCP transport) │ │
│ └────────────────────────┬───────────────────────────┘ │
└───────────────────────────┼──────────────────────────────┘
│
TCP / InternetHow Data Flows
Block Propagation
- A node creates a new block (send, receive, claim, lease, etc.)
- The block is added to the local ledger
- The block is published via GossipSub on the
xe/blockstopic - All subscribed peers receive the block, validate it, and add it to their ledgers
- If the block triggers a conflict, votes are broadcast on
xe/votes
Synchronization
When a new node joins or reconnects after downtime, it uses the sync protocol to catch up:
- On connection to a peer, the node sends its current frontiers (latest block per account)
- The peer compares frontiers and streams back any missing blocks
- A periodic re-sync every 10 seconds catches blocks missed during gossip
Peer-to-Peer Messaging
The messaging protocol provides request-response semantics for targeted communication:
- Marketplace negotiation (resource requests and offers)
- State chain synchronization
- Any typed message exchange between specific peers
Discovery Mechanisms
Peers find each other through three mechanisms:
- mDNS -- Automatic local network discovery. Nodes on the same LAN find each other without configuration.
- Bootstrap peers -- Explicit peer addresses passed via the
-dialflag. The node retries failed connections every 10 seconds. - Kademlia DHT -- Distributed hash table for discovering peers by their peer ID. Used by the Messenger to locate peers not already in the peerstore.
[!INFO] No Central Infrastructure XE has no tracker servers, seed nodes, or central coordination points. Any node can bootstrap from any other node. The DHT protocol prefix
/xeisolates the XE network from public IPFS DHT traffic.
Security Properties
- Transport encryption: libp2p provides encrypted connections by default (Noise or TLS 1.3)
- Peer identity: Each node has a persistent Ed25519 identity key, giving it a stable peer ID across restarts
- Message validation: GossipSub pre-validates field lengths before accepting messages
- Rate limiting: Sync protocol enforces a 5-second cooldown per peer to prevent abuse
- Size limits: All protocols enforce maximum message sizes to prevent memory exhaustion
Source Code
The networking layer lives in the core/net/ package:
File
Contents
host.go
Host creation, mDNS discovery, peer dialing
gossip.go
GossipSub for all broadcast topics
sync.go
Frontier-based block synchronization
msg.go
Request-response messaging protocol
dht.go
Kademlia DHT setup
messages.go
Wire format types for all message types