Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does DHT in torrents work?

Tags:

protocols

p2p

dht

I'm coding a p2p implementation that I would like to make decentralized however I'm having some trouble grasping how DHT in protocols like bittorrent work. How does the client know where the peers are if there is no tracker? Are peers stored in the actual torrent file?

like image 844
Christopher Tarquini Avatar asked Aug 26 '09 02:08

Christopher Tarquini


People also ask

How does BitTorrent DHT peer discovery work?

Once connected, the DHT server will send out a handful of peer IP addresses that you'll also connect to. They'll give you the addresses of peers connected to them, and so on, and so forth, until your peer list shows all the peers downloading (or seeding) the file you're trying to get.

What is DHT enable utorrent?

Enable DHT Network enables the Distributed Hash Table (DHT) if checked. You can also do this by right-clicking the DHT status in the main window status bar and selecting the corresponding option. Enable DHT for new torrents tells µTorrent to check for peers from the DHT network on each newly added torrent job.

Should DHT be enabled?

Should you use DHT? If you only use private trackers it has not effect to you, but if you use public ones, then yes. It can help reduce tracker load. Do I need to disable it?

What is a DHT protocol?

A distributed hash table (DHT) is a distributed system that provides a lookup service similar to a hash table: key–value pairs are stored in a DHT, and any participating node can efficiently retrieve the value associated with a given key.


1 Answers

With trackerless/DHT torrents, peer IP addresses are stored in the DHT using the BitTorrent infohash as the key. Since all a tracker does, basically, is respond to put/get requests, this functionality corresponds exactly to the interface that a DHT (distributed hash table) provides: it allows you to look up and store IP addresses in the DHT by infohash.

So a "get" request would look up a BT infohash and return a set of IP addresses. A "put" stores an IP address for a given infohash. This corresponds to the "announce" request you would otherwise make to the tracker to receive a dictionary of peer IP addresses.

In a DHT, peers are randomly assigned to store values belonging to a small fraction of the key space; the hashing ensures that keys are distributed randomly across participating peers. The DHT protocol (Kademlia for BitTorrent) ensures that put/get requests are routed efficiently to the peers responsible for maintaining a given key's IP address lists.

like image 63
cce Avatar answered Oct 16 '22 00:10

cce