Jump to content

How does a magnet link work? (first IP to connect)


Seyss

Recommended Posts

Ok,

I've read countless articles on the web and they all hide the most basic information:

What is the first IP my torrent client connect to when opening a magnet link? I know once it finds the first IP, others can be fetched using Peer Exchange.

Give me an example of what is contained in a magnet link. All those hex values are what?

Thanks!

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

I'm sorry that I have to bump this thread, but I have the same exact question and answering the question "How does DHT find IPs?" with "It finds them using DHT" is not a good answer at all.

When I tried Googling for information on this, this was the only relevant link I found. It's ridiculous how hard it is to find information on this open technology.

Link to comment
Share on other sites

  • 1 month later...

The first IP you connect to (besides a DNS) is a server that provides a list of public IP's. These IPs can be used as entry points into the DHT network. This list is usually provided by the same people who make the bitTorrent client, though of course technically you can find a participating IP by any method that works (like asking a friend).

After you enter the network, you'll discover more IPs by using DHT lookups. It's likely that these IPs will be stored locally on your hard drive so you can just connect directly next time without fetching the bootstrap list first.

The magnet link contains a hash -- basically a unique ID -- which identifies the file you're looking for. It doesn't contain any IPs, nor does it need to. A hash is mathematically calculated from the exact contents of the file. Due to the extreme calculations involved, a hash nearly never refers to any other file on the planet. It's almost impossible to spoof.

Other users on the DHT network know about this hash -> contents relation, so when you say "someone, gimme the exact sequence of bytes that match this hash", they do, and you have your file!

Hope that explains things.

Link to comment
Share on other sites

  • 1 month later...

Magnet Links, How do they work???

Srsly though, the poster before me is correct. Hash functions take in a big file and output a short string of characters which are (nearly) unique for that file. Some common hash functions you can read about are md5 and sha1.

Since a file will always output the same "digest", you can use that instead of filenames to refer to the content you want.

Link to comment
Share on other sites

  • 9 months later...

The initial bootstrap DHT peer on uTorrent is router.utorrent.com

Nobody answered the OPs question, I had the same question myself.

After the initial load, a cache of DHT peers is kept and used.

More reading:

http://stackoverflow.com/questions/1181301/how-does-a-dht-in-a-bittorent-client-get-bootstrapped

http://stackoverflow.com/questions/10999786/how-pex-protocol-magnetic-links-finds-it-first-ip

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...