Vesper-R4 is a high-performance simulation of a self-organizing, zero-coordination 3D hexagonal toroidal mesh. It models a fully decentralized network where nodes:
- Connect asynchronously to exactly 8 peers
- Dynamically determine their position in a 3D toroidal mesh
- Fill the mesh from the inside out, without prior knowledge of the full network
- Continuously update the mesh as nodes join or leave
- Converge deterministically into a perfect hexagonal structure
This simulation forms the backbone for a next-generation DHT alternative and scalable erasure-coded distributed filesystem, with strong resistance to censorship, Sybil attacks, and centralized failure.
- Peer Discovery: Nodes simulate discovery via access to a full list of potential peers (representing a complete DHT view).
- Dynamic Growth: Mesh size scales automatically based on node population, aiming for a target aspect ratio (e.g., 4:1 XY:Z).
- Deterministic Placement: Nodes derive their position from a double hash of their PeerID, sorted in a PeerID race among connected nodes during periodic recalculation.
- Reliable Convergence: Uses parallel connection attempts for speed and switches to serial connection for the last few nodes to ensure full connectivity.
- Fully Connected Topology: All nodes aim for 8 persistent connections.
- Toroidal Structure: The mesh wraps in X, Y, and Z directions to avoid edge effects.
- Self-Healing Topology: Nodes can swap positions and reorganize in-place as the mesh stabilizes.
- Initial Mesh Expansion: The mesh starts with a 1x1x1 structure and expands incrementally (e.g., 2x2x2, 3x3x3) as nodes join.
- Peer Connection: Nodes naturally connect to 8 peers before structure is imposed.
- PeerID Race: Each node is assigned a numerical value based on a double hash of its PeerID. Nodes broadcast this value into the DHT.
- Slot Assignment: Once a sufficient number of peers is counted, nodes are sorted by their numerical values, and slots are assigned to match their intended positions in the mesh.
- Incremental Structure Imposition: Every time the node count crosses an 8-node threshold (e.g., 8, 16, 24 nodes), the mesh structure is recalculated, and RoutingIDs are updated.
- Lightweight Updates: Updates are broadcast throughout the cluster using Vesper Routing, ensuring efficient and targeted message propagation.
Every RECALC_INTERVAL
cycles:
- The estimated mesh size is recomputed.
- A PeerID race is held among all nodes.
- The full mesh is reassigned using the current population and sorted PeerID values.
- All nodes recalculate their ideal position and compare to actual placement.
Metrics tracked include:
- Total number of nodes
- Average peers per node
- Percentage of nodes with exactly 8 peers
- Number of fully converged nodes (correct coord + 8 peers)
AsyncNode
: Represents an individual mesh node with ID, hash, connections, and target coordinate.simulate_async_network()
: Core loop for simulation cycles, node connection, and coordinate assignment.peerid_value()
: Double-hashing function for stable deterministic identity.index_to_coords()
: Converts mesh index to 3D toroidal coordinates.
Each cycle (or periodically) reports:
--- Mesh Convergence Stats ---
Cycle: 400 # Example cycle
Total Nodes: 16000
Average Peers per Node: 7.99
Nodes with 8 Peers: 15980 (99.9%)
Fully Converged Nodes: 15980 (99.9%)
- Support for continuous streaming mesh topology updates
- Distributed erasure coding + repair across the mesh
- Integration of fraud proofs and routing via deterministic mesh hops
- Global slot rebalancing and latency-based atomic swaps
- Efficient DHT over the mesh using positionally-encoded RoutingIDs
Reachable is identity. Structure emerges from connectivity.
Vesper-R4 assumes no central coordination, no privileged nodes, and no global truth beyond what can be observed and proven. It bootstraps order from chaos, using only local decisions and deterministic hashes to shape an entire computational topology.
- Python 3.8+
numpy
,pandas
python3 test6.py # Or specific script name
Edit the parameters at the top of the file to control:
TOTAL_NODES_TARGET
: Target node population (e.g., 16000)MAX_GROWTH_RATE
: Max fraction of target nodes added per cycle (e.g., 0.04)TARGET_XY_RATIO
,TARGET_Z_RATIO
: Target aspect ratio for mesh dimensions.MAX_PEERS
: Target peer count (e.g., 8)SERIAL_CONNECT_THRESHOLD
: Threshold to switch to serial connection for stragglers.RECALC_INTERVAL_NODES
: Node count interval for recalculation trigger.BROADCAST_INTERVAL
: Frequency (in seconds) for initiating new broadcast simulations.VISUAL_TIME_STEP
: Speed factor for visualizing broadcast propagation.
Simulation Logic Note: The simulation loop typically separates phases:
- Node Joining: New nodes are added based on the growth rate.
- Peer Connection: Nodes attempt to find and connect to peers (using simulated DHT).
- Rearrangement/Recalculation: Node positions are calculated and assigned based on the PeerID race.