agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Node ArchitectureGateway Front DoorProtocol ExplorerMesh NetworkingHeartbeat SystemData ShardingSSR & ShortlinksLocal Node Telemetry Rollups
Docs/Network/Mesh Networking
Network

Mesh Networking

WebSocket gossip mesh with K=6 neighbor selection, peer discovery, routing tables, partition healing, and self-healing topology.

#Mesh Networking

The gossip mesh is the communication backbone of the network. Every node maintains WebSocket connections to a carefully selected set of neighbors, forming an overlay network optimized for low-latency message propagation and partition resistance.

#WebSocket Mesh

All mesh communication flows over WebSocket connections at the /gossip endpoint. The protocol is binary-framed with typed message envelopes.

#Authentication

Every gossip connection is authenticated on handshake:

  • The connecting node sends a signature of "gossip-auth:{timestamp}" using its Ed25519 private key
  • The receiving node verifies the signature against the sender's known public key
  • The timestamp must be within a 30-second window to prevent replay attacks
  • If verification fails, the connection is rejected immediately

#Ping / Pong

Active connections send a Ping frame every 20 seconds. The round-trip time (RTT) from each Pong response is recorded and used for:

  • Neighbor selection scoring
  • Routing table RTT fields
  • Mesh rebalancing decisions
  • Heartbeat avgRtt field propagation

#K=6 Neighbor Selection

Each node maintains exactly 6 neighbor connections, selected across three tiers to balance latency, reach, and resilience:

TierCountSelection Criteria
Close3Lowest effective RTT, scored as measuredRtt + hopCount * 50ms
Mid-range2Bridge nodes that connect different clusters in the topology
Random1Random selection from all known peers, rotated periodically

The 3 close neighbors optimize for speed. The 2 mid-range neighbors ensure messages can cross cluster boundaries efficiently. The 1 random neighbor provides partition healing -- if the network splits, random connections are most likely to bridge the gap.

#Peer Discovery (4 Layers)

Nodes discover peers through four mechanisms, tried in order:

  • Projected node registry -- use the local event projection of registered, heartbeating nodes.
  • Gateway discovery -- query the gateway's /network/discover endpoint for the current list of healthy nodes.
  • Cached DB peers -- the local database stores previously seen peers from past sessions. Useful when the gateway is temporarily unreachable.
  • Foundation fallbacks -- foundation node addresses. Last resort to ensure a node can always find at least one peer.

Each layer is tried only if the previous layer yielded insufficient peers.

#Peer Exchange

Every 60 seconds, each node sends a peer exchange message to its neighbors containing 20 peers selected as:

  • 50% top peers (highest uptime, lowest latency)
  • 50% random peers (from the full routing table)

This mix ensures high-quality peers propagate quickly while random selection prevents the network from converging on a small set of "popular" nodes.

#Routing Table

Every node maintains a routing table with an entry for each known peer:

FieldDescription
nodeId16-byte unique node identifier
pubkeyEd25519 public key for signature verification
wsUrlWebSocket URL for direct connection
lastSeenAtTimestamp of last heartbeat or direct message
measuredRttDirectly measured round-trip time (from Ping/Pong)
reportedRttRTT reported by the peer in its heartbeat
hopCountNumber of hops from this node to the peer
isNeighborWhether this peer is one of the 6 active neighbors

#Alive Threshold and Pruning

  • A peer is considered alive if lastSeenAt is within the last 10 minutes
  • The routing table prune cycle runs every 60 seconds
  • Pruned peers are removed from the routing table but retained in the database for future peer exchange
  • Nodes that reappear after pruning are re-added on their next heartbeat

#Mesh Rebalancer

The rebalancer runs every 5 minutes by default, with adaptive timing between 2-10 minutes based on network stability:

  • Evaluate all current neighbors and candidate replacements
  • For each candidate, compute the effective RTT improvement over the worst current neighbor
  • Swap only if the improvement exceeds 10ms (prevents oscillation)
  • Run BFS from the local node across the routing table to detect partitions
  • If a partition is detected, prioritize connections to nodes on the other side

The adaptive interval shortens to 2 minutes when the network is unstable (frequent node departures) and extends to 10 minutes when the topology is stable.

#Self-Healing

When a neighbor goes offline, the self-healing protocol activates:

  • Adopt orphaned peers -- take 1-2 of the dead node's known neighbors as new connections, preventing their isolation
  • Broadcast NODE_OFFLINE -- send a typed message to all remaining neighbors so they can update their routing tables
  • Cooldown -- wait 30 seconds before making further topology changes (prevents cascading reactions)
  • Full rebalance -- after 5 minutes, run a complete rebalance cycle to optimize the new topology

If multiple neighbors go offline simultaneously, the node processes them sequentially with the 30-second cooldown between each, then triggers a single full rebalance at the end.

PreviousProtocol ExplorerNext Heartbeat System

On this page

  • Mesh Networking
  • WebSocket Mesh
  • Authentication
  • Ping / Pong
  • K=6 Neighbor Selection
  • Peer Discovery (4 Layers)
  • Peer Exchange
  • Routing Table
  • Alive Threshold and Pruning
  • Mesh Rebalancer
  • Self-Healing