Apex › Distributed systems

Kademlia DHT — the XOR metric

The distributed hash table behind BitTorrent, IPFS, and Ethereum node discovery. Its trick is measuring "distance" between IDs as their bitwise XOR — so two IDs are close exactly when they share a long binary prefix. Nodes keep k-buckets of contacts (many nearby, few far), and a lookup asks the closest peers it knows, then the closest they know, converging in O(log n) hops. Run a lookup and watch it fix another bit of the target's prefix each hop.

More in Distributed systems