P2P Networking

RougeChain uses a peer-to-peer network for block propagation, transaction broadcasting, and peer discovery.

How It Works

┌─────────────┐     blocks/txs      ┌─────────────┐
│   Node A    │ ◄─────────────────► │   Node B    │
│  (mining)   │                     │  (syncing)  │
└─────────────┘                     └─────────────┘
       ▲                                   ▲
       │           peer discovery          │
       └───────────────┬───────────────────┘
                       │
                       ▼
               ┌─────────────┐
               │   Node C    │
               │ (new peer)  │
               └─────────────┘

Features

FeatureDescription
Block SyncNodes download and verify blocks from peers
Transaction BroadcastSubmitted txs propagate to all peers
Peer DiscoveryNodes share their peer lists with each other
Genesis ResetNew nodes automatically adopt the network's chain

Connecting to the Network

As a Syncing Node

./quantum-vault-daemon \
  --api-port 5100 \
  --peers "https://testnet.rougechain.io"

As a Mining Node

./quantum-vault-daemon \
  --mine \
  --api-port 5100 \
  --peers "https://testnet.rougechain.io"

Peer Discovery

Nodes automatically discover new peers every 30 seconds by:

  1. Querying known peers via GET /api/peers
  2. Adding any new peers to their list
  3. Optionally registering themselves via POST /api/peers/register

Enable Self-Registration

./quantum-vault-daemon \
  --api-port 5100 \
  --peers "https://testnet.rougechain.io" \
  --public-url "https://mynode.example.com"

This tells other nodes how to reach you.

API Endpoints

EndpointMethodDescription
/api/peersGETList known peers
/api/peers/registerPOSTRegister as a peer
/api/blocks/importPOSTImport a block (peer-to-peer)
/api/tx/broadcastPOSTReceive a broadcasted transaction

Next Steps