Networking

libp2p host, GossipSub topics, frontier sync, DHT, and request-response messaging.


Fully peer-to-peer using libp2p. No central servers.

Components

ComponentPurposeProtocol
HostTCP transport, connection managementlibp2p core
GossipSubBroadcast blocks, votes, marketplace, statechain, directorylibp2p GossipSub
SyncFrontier-based block synchronization/xe/sync/1.0.0
MessagingRequest-response over streams/xe/msg/1.0.0
DHTKademlia peer discovery/xe prefix

Discovery Mechanisms

  1. mDNS — automatic local network discovery
  2. Bootstrap peers — explicit via -dial flag, retry every 10s
  3. Kademlia DHT — distributed hash table with /xe prefix

GossipSub Topics

TopicData TypeBuffer
xe/blocksBlock256
xe/votesVote256
xe/marketplaceMarketplaceMsg256
xe/statechainStateChainBlock16
xe/directoryRegistration256
xe/certificatesCertificate64

Max gossip message size: 256 KB.

Sync Protocol

  • Frontier-based: exchange account → latest block hash
  • Paginated responses (default 64 blocks/page, max 256)
  • Max 10,000 blocks per sync session
  • 5-second per-peer cooldown
  • Periodic re-sync every 10 seconds (with dirty flag optimization)
  • Cross-account dependency retry (up to 3 passes)
  • Block quarantine for permanently invalid blocks

Messaging Protocol

  • Request-response semantics
  • 30-second stream deadline
  • 64 KB max request/response
  • Message types: vm_credentials, vm_status, account_chat, attest_timestamp
  • DHT-based peer discovery fallback

Security

  • Transport encryption (Noise or TLS 1.3)
  • Persistent Ed25519 identity
  • GossipSub pre-validates field lengths
  • Sync rate limiting (5s per peer)
  • Max message sizes enforced

Host Configuration

  • TCP on all interfaces, configurable port
  • Connection manager: low=100, high=400, grace=1min
  • Persistent identity at {dataDir}/host.key
  • Optional relay + hole-punching support