Sunday, March 15, 2009

What does it take to download a torrent?

The simple answer to this question is "All you need is the .torrent file. Stupid n00bs." This is true. The .torrent file contains all the metadata required to A) download the data and B) verify the data. Without this, you can't really do anything. So, do you actually need the .torrent file to begin a download?

No! All you need is the infohash for the .torrent file! The infohash is the SHA1 hash of the metadata in a .torrent file. As such, it can be used as a unique identifier for a particular .torrent file. With this infohash, you can query the BitTorrent DHT for a list of peers downloading that torrent. Then, with the help of the Metadata Exchange extension, you can connect to these peers and request that they send you the metadata from the .torrent file and you're away and downloading. Great!

"But what if some malicious peer sends you corrupt metadata, then you'd never be able to download the torrent properly!", I hear you asking. Well, in a rather beautiful twist, this is next to impossible. As I said earlier, the infohash is generated by putting the metadata in the .torrent file through a SHA1 hash. So all you have to do is hash the metadata once you have received it and then compare the result of that to the SHA1 hash you used to start the download. If they match, then you can be fairly confident that the metadata has not been corrupted/altered in any way.

As of 17:00GMT, March 15th MonoTorrent has completed its first download using only a 20 byte hash to begin the download. This is possible because of some tireless work by Olivier Dufour, who also implemented Peer Exchange, a good few parts of DHT, WebSeeding and SuperSeeding. The code for this still hasn't quite hit SVN, a bit of refactoring remains to be done. It should be in SVN within a week. I'm looking forward to his next patch of awesomenesss now.

17 comments:

Anonymous said...

Does this mean that now you can download torrents by having just a URL? For instance something like bttp://3874A39239827F2937....

Alan said...

Exactly. The actual format is as follows:

magnet:?xt=urn:btih:INFOHASH&dn=NAME&tr=TRACKERURL

btif = bittorrent infohash
dn = display name (optional)
tr = tracker (optional)

If no tracker is specified, DHT is used to find peers. You can read the spec for more details if you want.

Strob said...

But how and where do I enter that info?

I'm trying to download a toorent but I have only the hash and file name

sweety said...

You may try to download the torrent at this site - http://file.sh

Alan said...

@strob:

There's a constructor overload for TorrentManager which takes an infohash and a path/name instead of an actual Torrent (created from a .torrent file). This is what you need to use.

Sildenafil said...

I was a faithful user of UTorrent, I used to download everything, music, videos, software, TV shows, movies, files, all. But, then I realized that my computer were getting a lot of viruses so I had to stop using it

camping antibes said...

camping antibes

maison antibes said...

maison antibes

PR5 Directory said...

Free PR5 directory

VPN Torrent said...

VPN Torrent

awe said...

pretty neat!

pH electrodes

London Crumpet said...

London escorts directory London Crumpet is created to expose Independent escorts and escort agencies in London. Everybody can post their advert on this directory for FREE.

Unknown said...

I'm happy about everything you bring it very interesting and helpful, thanks
Signature:
i like play games friv4 online and play games2girls Download baixar facebook movel

Unknown said...

Great info. I love all the posts, I really enjoyed, I would like more information about this, because it is very nice., Thanks for sharing.
kids games
friv
unblockedgames
un show mas

Expertise for Hire said...

I may not have an idea of what it may take to download a torrent, but one thing am very sure is that a Blue Ceramic Downlight can actually make your house more brighter and beautiful. This is a nice post that you have shared, it can be complimented by quality information on interior decor.

Daniel Lambert said...

Thanks for the information. I used services of PDFL for Chemical tank fabrications, And its superb

zara8359 said...

thank you are for posting this wonderful information with us i really find it useful, keep up this good work. Bathroom Renovation Dubai

Hit Counter