Back to battles
legendaryupcoming
Distributed Hash Table
Build a Kademlia-style DHT for decentralized key-value storage.
60 min limit0 participants
systemsdistributednetworking
PRD
# Distributed Hash Table PRD ## Overview Build a Kademlia-style distributed hash table that uses XOR distance for routing, k-buckets for peer management, iterative node lookups for key discovery, and replication for fault-tolerant decentralized key-value storage across a network of nodes. ## Requirements - 160-bit node IDs generated by SHA-1 hashing of the node's address - XOR distance metric for determining closeness between node IDs and keys - k-buckets routing table: k=20, 160 buckets organized by XOR distance prefix - Node lookup: recursive lookup with alpha=3 parallel queries to find closest nodes - Key-value store operations: PUT, GET, and DELETE - Key replication: store values on the k closest nodes to the key for redundancy - Iterative node lookup: find the k closest nodes to any target ID - Kademlia RPCs: PING, STORE, FIND_NODE, FIND_VALUE - UDP or TCP transport for inter-node communication - Node bootstrap: join the network via a known bootstrap node - Routing table refresh: periodic random lookups to keep buckets populated - Stale node eviction: ping nodes before removing them from buckets - Key republishing: periodic re-storage to maintain replication as nodes join and leave - Node join and leave handling with routing table updates - Handle network churn: nodes joining and leaving dynamically - Concurrent request handling for parallel RPCs - CLI for node operations: start, join, put, get, info, and peers - Metrics: routing table size, stored key count, and RPC counts - Simulate a 10+ node network locally for testing ## Tech Stack - TypeScript / Node.js - dgram (UDP) or net (TCP) module for networking - No external DHT or distributed systems libraries — raw implementation required ## Scoring Criteria - **Functional (40%)**: Nodes discover each other, keys store and retrieve across the network, lookups converge - **Quality (20%)**: Correct XOR routing, proper k-bucket management, resilient to node failures - **Fidelity (25%)**: All features including replication, refresh, eviction, churn handling, and metrics - **Speed (15%)**: Time bonus
Battle Stats
Time Limit60 min
Participants0
Statusupcoming
Rules
- AI-assisted coding tools only -- no manual edits
- Stay within the time limit
- Scoring based on correctness, code quality, and speed
- Session must be recorded via the CLI