Kademlia nodes communicate among themselves using UDP. A virtual or overlay network is formed by the participant nodes. Each node is identified by a number or node ID. The node ID serves not only as identification, but the Kademlia algorithm uses the node ID to locate values usually file hashes or keywords. In fact, the node ID provides a direct map to file hashes and that node stores information on where to obtain the file or resource. When searching for some value, the algorithm needs to know the associated key and explores the network in several steps.
|Published (Last):||15 December 2013|
|PDF File Size:||3.11 Mb|
|ePub File Size:||10.21 Mb|
|Price:||Free* [*Free Regsitration Required]|
Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Recently, I've read a document of the Kademlia Protocol, I tried to understand the protocol, but I still have some question: Why a node must find another node when he knows its ID but ip or port?
Why he has the ID while he doesn't know the ip or port, where did he get the ID? I think the "distance" between two different nodes is not a routing distance or real distance, it's only a virtual distance that can be used the algorithm to find the node quickly, it's that right? Maybe my English is not very clear because English is not my mother tongue, but I'll try to express myself clear if you need. Thanks very much!
As cHao said, the distributed nature of the network means that nodes need to publish their IDs and their contact details to other nodes they talk to. There is no central place where IDs are mapped to contact info, so each node must keep this mapping for a subset of the nodes on the network in its own routing table.
Kademlia routing tables are structured so that nodes will have detailed knowledge of the network close to them, and exponentially decreasing knowledge further away. Imagine a simple example where the IDs are in the range 00 to If Kademlia used e. Using XOR, the distance between 15 and 25 is 22, and between 25 and 35 it's The constant k has a couple of uses in Kademlia, but it's primarily the replication factor.
In other words, a piece of data is stored on the k closest nodes to the data's ID. The lookup process is designed to return either a group of k nodes before storing data on each of them or return a single piece of data from the first node holding it during the lookup iterations.
Because of this, pure Kademlia isn't best suited to finding just a single node, so I'm not sure that part of your question is too relevant.
If you did want to use Kademlia to find a single node, it would probably be worth modifying the lookup process to finish early as soon as any node returns the target node's contact details in the same way that the lookup finishes early if a target value is found during the process. Nodes don't have to and usually don't know about all the other nodes.
The process of "finding" a node is basically to ask known nodes "closest" to the target not so much about the target node directly, but about what nodes are closer to the target. The result of that query gives you the next group of nodes to query, and the process repeats -- and because a node would return results that are closer than it is, each iteration tends to find nodes closer and closer to the target til you finally reach a node that can say "Oh, node X?
He's right over there. Learn more. Asked 8 years, 3 months ago. Active 1 year, 5 months ago. Viewed 9k times. Dara Tith 7 7 silver badges 18 18 bronze badges. Checkout gleamly. Active Oldest Votes. In this way, the group of k closest IDs to a target ID can be calculated unambiguously. Fraser Fraser And what is the real meaning of the "distance" between two nodes?
Is it because X has the file which I want? It also seems node IDs and IDs of "values" ie: content, files,lookup info, whatever share the same keyspace, and one of the points of finding the "closest" nodes to a key is to tell them to store the info. Finding a value works the same as finding a node, except that if a node has the value corresponding to the ID, it responds with that instead of a list of nodes.
So the Distance is only a value to use the quick search algorithm. Your answer is helpful, thanks! Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
Subscribe to RSS
Source code for kademlia.protocol