Search code examples
dhtkademlia

Kadelmia routing table - is bidrectional routing necessary?


Say you have node u which contains node w in its routing table. Is it necessary for node u to be present in node w's routing table?


Solution

  • I'm not sure if it requires it, but the main advantage of using xor-metric as a distance function is that x to y is the same distance as y to x.

    And adding to that, when bootstrapping nodes, the joining node is supposed to get connection information from the bootstrapper and ping those nodes... and on the first ping/connection any node receives they will save the connection info for the node calling the rpc!

    So I don't think Kademlia requires it per say, but it will most likely always be the case.

    The only time I can see this not being true is when a node is calling the find_node rpc and it has already received the connection info for the destination node (assuming it isn't in the caller's routing table) but hasn't pinged the destination node yet.

    Do correct me if I'm wrong, but this is what I have gathered from reading the paper and several implementations/articles/examples

    Also, this might be a helpful asset while working on Kademlia: Kademlia Visualizer

    EDIT: I remembered a case where this won't be true, it's when you ping a node that already has a full bucket/routing table (alive nodes) he will not replace any of it's nodes with the calling one.