Where does a magnet/torrent client look for the hash/torrent/file?

9

1

In short:

Wikipedia mentions a required "availability search" to find peers (and the actual file):

Note that, although a particular file is indicated, an availability search for it must still be carried out by the client application.

Where does the client look? Does a magnet link require a tracker URI or is that up to the client's network?

More info:

A certain magnet URI/URN from tpb looks like this:

magnet:?xt=urn:btih:e9b785fc2d70811a72df5a76bb34bd2eaf9df956&dn=Dances+with+Wolves+1990+20th+Anniversary+Extended+Cut+720p+BRRip&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80

It contains 4 tr query params with (I suppose) tracker locations that contain some sort of hash index. However, Wikipedia doesn't mention the tr param, so I assume it's not mandatory.

Where does a client start looking for the file if no tracker URI's are included? And if there are? I can imagine a torrent client (like uTorrent) itself having an enormous index of file hashes.

Rudie

Posted 2013-02-21T18:57:35.657

Reputation: 519

2

Kudos for asking so nicely, just a small correction though: The Wikipedia does mention the tr parameter (at least at the time I was viewing it's article)

– Saxtus – 2013-02-22T19:15:22.820

My bad. I only saw the params part under "Technical description". It's not mentioned there. It says "without a need for DHT support". Wouldn't a client just always use DHT and/or PeX even when a tracker was proved? (If not, why not?) – Rudie – 2013-02-22T21:52:24.177

Answers

7

The client will use DHT and Peer Exchange to look for clients if no trackers are provided.

Der Hochstapler

Posted 2013-02-21T18:57:35.657

Reputation: 77 228

Would the above magnet URI work if I removed the tr params? My uTorrent client would look via DHT and PeX? Would it use (or even find) trackers from other peers (because others did get the full magnet URI, including trackers)? – Rudie – 2013-02-22T21:46:34.437

@Rudie: It should work. How well it will work depends on the client, your network, how common the file is within the swarm, ... – Der Hochstapler – 2013-02-22T21:53:29.890

Would it look for trackers or skip the whole tracker approach if an initial tracker wasn't provider? (Would a peer ever share the tracker URL with another peer?) I'm sorry for being annoying and redundant, but I just have to know =) – Rudie – 2013-02-22T21:56:41.973

Also (sorry!), Wikipedia says "identifies a file", yet a torrent can contain many many files. Is the whole package the file mentioned, or does every actual file have its own magnet hash? – Rudie – 2013-02-22T22:01:01.157

@Rudie: To my understanding, clients do not trade trackers. They only trade other clients. A quick test I just performed seemed to confirm this. I'm assuming the "file" mentioned on Wikipedia relates to the data container that describes the torrent contents. – Der Hochstapler – 2013-02-22T22:07:37.757

3

If trackers are listed, the client will query them first. If none are listed, DHT is used to query other clients for copies of the file, and then PEX kicks in to find more copies once the first has been found. Even if trackers are found, the client may still leverage DHT to find additional peers.

The trackerless approach is analogous to the Gnutella(2) network if you were familiar with its operation.

BowlesCR

Posted 2013-02-21T18:57:35.657

Reputation: 2 607

DHT and PeX would work very well together, wouldn't they? Why first DHT and then PeX? (Does the DHT result contain PeX trackers or something??) The principle is the same, isn't it? Ask from peers in the client's network? – Rudie – 2013-02-22T21:48:42.763

Sorry to dig this back from the dead. DHT finds a seed/peer even when you have none for a given torrent. PEX communicates with existing peers to find more. – BowlesCR – 2013-08-12T15:42:06.533