Skip to content

Instantly share code, notes, and snippets.

@alexstrat
alexstrat / IterativeFindV2
Created January 4, 2012 20:11
Iterative find process for Kademlia (v2)
# in this algorithm, all notions of *sorting*, *close* or *distance*
# are relative to the XOR distance with the target ID
# as defined in the Kademlia spec
- iterative find (target ID) ->
# initializations
HeardOf <- XOR Sorted Array of peers
initialized with the 50 (or less) closest peers we know from the our routing table
Reached <- XOR Sorted Array of peers
Queried <- Array of peers