Skip to content

Instantly share code, notes, and snippets.

@jinroh
jinroh / gist:1555907
Last active Sep 29, 2015
Kademlia Iterative Find (v1)
View gist:1555907
# 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