Skip to main content

P2P Protocol

Pakit's peer-to-peer layer distributes DAG blocks across the network with cryptographic verification of every remote byte. It is purpose-built for the sovereign storage network — no dependency on external systems.

Components

ComponentDesign
Kademlia DHT160-bit ID space, k-buckets for peer/block discovery
Gossip protocolFanout 6, TTL 10 — epidemic block propagation
Request/responseBatched retrieval with priority queues (up to 100 blocks per request)
Merkle verifierCryptographic validation of untrusted data
Reputation0.0–1.0 behavioral score for peer selection
TransportAsync TCP with connection pooling (max 50 peers)

Design Goals

  1. Sovereignty — zero external backend dependencies
  2. Security — every remote block is hash-verified before use
  3. Performance — target <100 ms DHT lookups, <500 ms gossip propagation
  4. Scale — designed for 1,000+ nodes per network
  5. Resilience — partition tolerance and automatic peer eviction

Discovery and Retrieval Flow

Client ──▶ DHT lookup (content hash)
              │
              ▼
        Provider peers ──▶ Block request (batched)
              │
              ▼
        Merkle verification ──▶ Local DAG insert
  1. Look up the content hash in the DHT to find provider peers
  2. Request the block batch from the best-scoring peers
  3. Verify the Merkle proof against the requested content ID
  4. Store only after verification succeeds

Reputation System

Peers are scored on behavior: successful block deliveries raise a peer's score, invalid or missing responses lower it. Low-reputation peers are deprioritized and eventually evicted. This keeps content integrity enforcement decentralized.

Security Model

  • All blocks are verified against their content hash — a malicious peer cannot inject altered data
  • Connection pools are bounded, limiting resource exhaustion
  • Peer identity is anchored to the on-chain validator registry where available

Related