<p>DHTs are built so that nodes keep only a small portion of other nodes addresses in their routing table (the closest ones). This means that when you send a message to a DHT to put("foo", "bar"), only specific peers are going to see it (in fact as little as possible) and even fewer are going to store it. So if you want to do "peer lookup" using DHTs, it wouldn't work because nodes aren't programmed to send messages through a path to all nodes. </p>

<p>Also I think you may be confused with BitTorrent's DHT. They store IP addressed of peers downloading torrents as values of keys in the DHT. So in that sense, they do use the DHT to "lookup peers" downloading a specific torrent. BitTorrent is a different system than Bitcoin, which is not a file-transfer protocol, and therefore I don't see how a DHT can be useful to Bitcoin's design.</p>

CC BY-SA 3.0
2015-05-14T19:00:40.080Z
I edited the question to make it more clear. You can most certainly use a DHT like structure to select Peers. Its not quite a full DHT because we wouldn't be storing any hashes.
null_radix
CC BY-SA 3.0
2015-05-14T20:54:49.203Z
your question is still not very clear. what are you trying to do?
Luca Matteis
CC BY-SA 3.0
2015-05-15T13:48:25.973Z
trying to find peers to connect to. you can do this with an greed algo (ie. ask a bootstraping peer to give you all the peers it knows about and so forth) or storing peers in k-buckets (DHT) and connecting to them on the basis of their XOR distance. Which should give you a "better" network topology.  Is there any reason that bitcoin uses a greedy algo and not something?
null_radix
CC BY-SA 3.0
2015-05-15T16:01:30.060Z
Actually DHTs don't say anything regarding "how to find peers". DHTs have a logic of understanding which peers to keep and which to reject, and the result is that you end up connecting to peers that are XOR closest to you. In terms of "how to find peers", the logic is similar to Bitcoin - just ask other peers about their routing table. Also, the XOR distance is useful for performing key lookups - it reduces to a minimum the number of hops to find peers storing a specific key - how would it be used in Bitcoin?
Luca Matteis
CC BY-SA 3.0
2015-12-21T19:35:01.453Z
Other blockchain projects, like [Twister](http://twister.net.co/), use BitTorrent/DHT, so why doesn't Bitcoin?
Geremia
CC BY-SA 3.0
2018-03-08T05:47:49.270Z
I have seen this conversation before in antivirus forums - why doesn't AV XYZ use X method for distributing updates, it would be better/faster/foo/bar.
Willtech
CC BY-SA 4.0
2018-07-13T07:04:42.740Z
Event Bittorrent DHT has a bootstrap server that talks to Bittorrent server. Still, DNS is centralized so DHT would be a more decentralized way to find peers. I think it fits the spirit of Bitcoin better than DNS.
Sun
CC BY-SA 3.0
2015-05-12T23:00:34.273Z
2015-05-12T23:00:34.273Z
Luca Matteis
<p>Why does Bitcoin use a gossip protocol rather than a DHT for peer discovery? I believe that kademlia XOR distance helps shape the network topology so that peers are more evenly disturbed. </p>

CC BY-SA 3.0
2015-05-12T21:37:56.063Z
What does 'peer lookup' mean? Bitcoin does not have any local data specific to a node, and every node needs to learn everything anyway. We have peer selection logic, but it optimizes for DoS protection robustness and propagation speed. What exactly would it use a DHT for?
Pieter Wuille
CC BY-SA 3.0
2015-05-12T22:46:27.913Z
i think he's talking about the BitTorrent DHT implementation, which is used to find peers - Bittorrent's DHT stores IP addresses of peers downloading the torrent as values - although generally DHT's aren't used for that.
Luca Matteis
CC BY-SA 3.0
2015-05-13T21:31:59.677Z
@NickODell i mean peer discover. Is that clear?
null_radix
CC BY-SA 3.0
2015-05-13T21:54:30.470Z
@PieterWuille With XOR-Topology you have more evenly connected network. With Gossip peers that stay online for a long time tend to have more connection. Since almost every peer will know about it. But I'm not 100% sure about this so I'm asking here.
null_radix
<client>
Why doesn't Bitcoin use a DHT for choosing peers?
null_radix
# Why doesn't Bitcoin use a DHT for choosing peers?

(Asked by: username_0 on 2015-05-12)

Why does Bitcoin use a gossip protocol rather than a DHT for peer discovery? I believe that kademlia XOR distance helps shape the network topology so that peers are more evenly disturbed.

**Tags:** client

> **Comments:**
> **username_1**: What does 'peer lookup' mean? Bitcoin does not have any local data specific to a node, and every node needs to learn everything anyway. We have peer selection logic, but it optimizes for DoS protection robustness and propagation speed. What exactly would it use a DHT for?  
> **username_2**: i think he's talking about the BitTorrent DHT implementation, which is used to find peers - Bittorrent's DHT stores IP addresses of peers downloading the torrent as values - although generally DHT's aren't used for that.  
> **username_0**: @NickODell i mean peer discover. Is that clear?  
> **username_0**: @username_1 With XOR-Topology you have more evenly connected network. With Gossip peers that stay online for a long time tend to have more connection. Since almost every peer will know about it. But I'm not 100% sure about this so I'm asking here.  

---

## 1 answers

### Answer by username_2 on 2015-05-12. Score: 8

DHTs are built so that nodes keep only a small portion of other nodes addresses in their routing table (the closest ones). This means that when you send a message to a DHT to put("foo", "bar"), only specific peers are going to see it (in fact as little as possible) and even fewer are going to store it. So if you want to do "peer lookup" using DHTs, it wouldn't work because nodes aren't programmed to send messages through a path to all nodes.

Also I think you may be confused with BitTorrent's DHT. They store IP addressed of peers downloading torrents as values of keys in the DHT. So in that sense, they do use the DHT to "lookup peers" downloading a specific torrent. BitTorrent is a different system than Bitcoin, which is not a file-transfer protocol, and therefore I don't see how a DHT can be useful to Bitcoin's design.

> **Comments:**
> **username_0**: I edited the question to make it more clear. You can most certainly use a DHT like structure to select Peers. Its not quite a full DHT because we wouldn't be storing any hashes.  
> **username_2**: your question is still not very clear. what are you trying to do?  
> **username_0**: trying to find peers to connect to. you can do this with an greed algo (ie. ask a bootstraping peer to give you all the peers it knows about and so forth) or storing peers in k-buckets (DHT) and connecting to them on the basis of their XOR distance. Which should give you a "better" network topology.  Is there any reason that bitcoin uses a greedy algo and not something?  
> **username_2**: Actually DHTs don't say anything regarding "how to find peers". DHTs have a logic of understanding which peers to keep and which to reject, and the result is that you end up connecting to peers that are XOR closest to you. In terms of "how to find peers", the logic is similar to Bitcoin - just ask other peers about their routing table. Also, the XOR distance is useful for performing key lookups - it reduces to a minimum the number of hops to find peers storing a specific key - how would it be used in Bitcoin?  
> **username_3**: Other blockchain projects, like [Twister](http://twister.net.co/), use BitTorrent/DHT, so why doesn't Bitcoin?  
> **username_4**: I have seen this conversation before in antivirus forums - why doesn't AV XYZ use X method for distributing updates, it would be better/faster/foo/bar.  
> **username_5**: Event Bittorrent DHT has a bootstrap server that talks to Bittorrent server. Still, DNS is centralized so DHT would be a more decentralized way to find peers. I think it fits the spirit of Bitcoin better than DNS.  

---

