Improve the quality of connections via a more complete distance metric #252

issue stuhood opened this issue on May 22, 2011
  1. stuhood commented at 2:27 AM on May 22, 2011: none

    Currently, connections are made to nodes which don't share the first two octets of the IP address, which raises the bar for attackers who are trying to prevent knowledge of blocks or transactions from spreading through the network. But adopting a more complete metric for distance could further minimize the chance of being fenced in due to only connecting to untrustworthy nodes.

    The Kademlia protocol uses the XOR metric to determine the distance between two IP addresses. Applied to Bitcoin, a variant of the XOR metric might be to attempt to connect to the farthest node from the joining address in each k-bucket: aka, one node that has a particular bit of its IP address set, for a total of 32 buckets (or 128 for IPv6).

  2. stuhood commented at 9:58 AM on May 24, 2011: none

    Here is an example of the XOR metric used to bin IP addresses by distance (using IPs from #bitcoin IRC): code: https://gist.github.com/988452 output: https://gist.github.com/988443

    My hypothesis is that bucketing connections like this would lead to lower overall latencies by dropping the average distance a transaction has to travel to span the entire network. Bit hand-wavey at the moment, but I'll see if I can come up with some numbers to back up the idea.

  3. TheBlueMatt commented at 10:43 PM on May 29, 2011: member

    Chosing which nodes to make outgoing connections too could use an upgrade like this, as could general connection tactics (being more aggressive couldn't hurt this insane times for bootstrapping that have been seen recently). @stuhood might you consider writing that into the Bitcoin client for us? Everything should be in sr/net.cpp

  4. stuhood commented at 11:32 PM on May 29, 2011: none

    Yes: I'd be happy to implement this in the next few weeks.

  5. laanwj commented at 6:37 PM on December 3, 2011: member

    @stuhood how is the implementation coming along? :)

  6. stuhood commented at 8:09 AM on December 19, 2011: none

    @laanwj It's not... sorry! Got caught up in other obligations.

  7. gavinandresen commented at 7:28 PM on April 4, 2012: contributor

    Closing this; sipa's CAddrMan has a well-thought-out policy for which potential peers to connect with.

  8. gavinandresen closed this on Apr 4, 2012

  9. zathras-crypto referenced this in commit b3a4a2d0ce on Dec 19, 2014
  10. sipa referenced this in commit 7863d105ea on Aug 4, 2015
  11. sipa referenced this in commit 780d5b3c7b on Aug 23, 2015
  12. dexX7 referenced this in commit 106c5e9912 on Oct 8, 2015
  13. TheBlueMatt referenced this in commit a671356e1f on Oct 20, 2015
  14. sipa referenced this in commit 9177950c74 on Oct 21, 2015
  15. sipa referenced this in commit f4787d1caf on Oct 21, 2015
  16. sipa referenced this in commit 6557a8cd46 on Oct 26, 2015
  17. sipa referenced this in commit ea06490d14 on Oct 27, 2015
  18. sipa referenced this in commit 003bb87153 on Nov 5, 2015
  19. sipa referenced this in commit bfd83199c3 on Nov 11, 2015
  20. sipa referenced this in commit b437ea7ec9 on Nov 12, 2015
  21. sipa referenced this in commit 1d84107924 on Nov 12, 2015
  22. rebroad referenced this in commit 40ead34fbe on Dec 7, 2016
  23. deadalnix referenced this in commit d84a3784f4 on Jan 19, 2017
  24. deadalnix referenced this in commit ada7489018 on Jan 19, 2017
  25. deadalnix referenced this in commit 7a597cd5ff on May 10, 2017
  26. lateminer referenced this in commit 9359d94c18 on Dec 9, 2017
  27. classesjack referenced this in commit 61841be365 on Jan 2, 2018
  28. attilaaf referenced this in commit fef6de827a on Jan 13, 2020
  29. cryptapus referenced this in commit a439016b42 on May 3, 2021
  30. rajarshimaitra referenced this in commit fe98ecb312 on Aug 5, 2021
  31. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me