Mainline DHT bootstrap process












4















Can somebody clarify me the statement from the specification of mainline DHT?




Upon inserting the first node into its routing table and when starting up thereafter, the node should attempt to find the closest nodes in the DHT to itself. It does this by issuing find_node messages to closer and closer nodes until it cannot find any closer.




What does "until it cannot find any closer" mean?



When my program start to send find_node messages it has empty set of nodes. Each response to find_node message returns about 8 dht nodes. My program collects them in the list.



When must my program stop sending find node messages?



I think that it must stop sending when it will receive the set of dht nodes all elements of which are in the list of already collected nodes?



Am I right?



Thank you in advance.










share|improve this question





























    4















    Can somebody clarify me the statement from the specification of mainline DHT?




    Upon inserting the first node into its routing table and when starting up thereafter, the node should attempt to find the closest nodes in the DHT to itself. It does this by issuing find_node messages to closer and closer nodes until it cannot find any closer.




    What does "until it cannot find any closer" mean?



    When my program start to send find_node messages it has empty set of nodes. Each response to find_node message returns about 8 dht nodes. My program collects them in the list.



    When must my program stop sending find node messages?



    I think that it must stop sending when it will receive the set of dht nodes all elements of which are in the list of already collected nodes?



    Am I right?



    Thank you in advance.










    share|improve this question



























      4












      4








      4


      4






      Can somebody clarify me the statement from the specification of mainline DHT?




      Upon inserting the first node into its routing table and when starting up thereafter, the node should attempt to find the closest nodes in the DHT to itself. It does this by issuing find_node messages to closer and closer nodes until it cannot find any closer.




      What does "until it cannot find any closer" mean?



      When my program start to send find_node messages it has empty set of nodes. Each response to find_node message returns about 8 dht nodes. My program collects them in the list.



      When must my program stop sending find node messages?



      I think that it must stop sending when it will receive the set of dht nodes all elements of which are in the list of already collected nodes?



      Am I right?



      Thank you in advance.










      share|improve this question
















      Can somebody clarify me the statement from the specification of mainline DHT?




      Upon inserting the first node into its routing table and when starting up thereafter, the node should attempt to find the closest nodes in the DHT to itself. It does this by issuing find_node messages to closer and closer nodes until it cannot find any closer.




      What does "until it cannot find any closer" mean?



      When my program start to send find_node messages it has empty set of nodes. Each response to find_node message returns about 8 dht nodes. My program collects them in the list.



      When must my program stop sending find node messages?



      I think that it must stop sending when it will receive the set of dht nodes all elements of which are in the list of already collected nodes?



      Am I right?



      Thank you in advance.







      implementation bootstrapping bittorrent dht






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 '15 at 0:31









      Siguza

      12.4k63451




      12.4k63451










      asked Sep 28 '11 at 21:18









      Art SpaskyArt Spasky

      69521023




      69521023
























          1 Answer
          1






          active

          oldest

          votes


















          6














          Mainline DHT is a kademlia implementation, for details, see the paper.



          From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).



          As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.



          In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7589717%2fmainline-dht-bootstrap-process%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6














            Mainline DHT is a kademlia implementation, for details, see the paper.



            From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).



            As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.



            In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.






            share|improve this answer






























              6














              Mainline DHT is a kademlia implementation, for details, see the paper.



              From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).



              As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.



              In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.






              share|improve this answer




























                6












                6








                6







                Mainline DHT is a kademlia implementation, for details, see the paper.



                From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).



                As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.



                In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.






                share|improve this answer















                Mainline DHT is a kademlia implementation, for details, see the paper.



                From the 8 nodes you receive, sort them by their node-id's closeness to your own ID, then send find_node to the 3 top ones (the 3 closest to you). You will then receive 8 x 3 more nodes, insert them in your node list, still ordered by how close the nodes are to you. Keep sending find_node messages to the 3 top nodes (ignoring ones you've already sent messages to), until the nodes you get back are already in your list. i.e. the termination condition is that you have sent a message to all 8 nodes closest to you (at the top of the list).



                As the paper explains, the distance metric is XOR. To calculate how far away your node-ID is from another node's, you XOR the node-IDs. The lower the result is, the closer the nodes are to each other.



                In real life you might want to do this a bit more sophisticated, by keeping 3 outstanding requests at any given time and temporarily open up more outstanding requests half way through timeouts.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 19 '18 at 23:26









                ArtemGr

                7,60713463




                7,60713463










                answered Sep 29 '11 at 4:20









                ArvidArvid

                9,06012331




                9,06012331
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7589717%2fmainline-dht-bootstrap-process%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Xamarin.form Move up view when keyboard appear

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Anylogic : not able to use stopDelay()