Sunday, 18 March 2012

BitTorrent & Magnets: How Do They Work?

As we recently reported, The Pirate Bay has switched from using .torrent file downloads to magnet links with no opt-out policy. The tracker has offered magnet downloads for a good while now, but this is the first time we’ve seen such a large public tracker use embedded links exclusively.

So what does it mean for the army of BitTorrent junkies out there? Not an awful lot, it turns out. Magnets don’t operate in precisely the same way as standard .torrent files but it won’t take long for you to get your head around the new standard.

Magnets Explained

Magnets are not a particularly recent addition to the arsenal of filesharing technologies out there. Those of you who remember Freenet and eDonkey 2000 will recall similar methods being used as long ago as 2002. While the standard is still evolving, magnets use largely the same technology that these old P2P networks relied on.

Unlike .torrent files, magnets can be embedded directly into a webpage as nothing more than a link. This link is made up of several parts and prefixed with the magnet: identifier. These links comprise of several identifiers (like the “exact topic” (xt) ?xt=urn:btih: prefixing the BitTorrent info hash), a hash value of the torrent file and sometimes other information like trackers (tr) and file name data (dn). The parts that make up a magnet link do not need to be presented in any particular order.

Here is the magnet link for Linux Mint listed on The Pirate Bay:

These links contain all necessary information to begin downloading files from other peers directly, either using tracker information stored in the link or distributed hash tables (DHT) and peer exchange (PEX).


These two aren’t particularly new either, and you’ve probably been using both for years without realising it. DHT was first demoed in 2005 and works by searching for peers who are downloading the same file without contacting any trackers. This essentially creates a “trackerless torrent” and is something TPB have been pushing for a while now.

If you click a magnet link that does not specify a tracker (tr) the first peer will be found using DHT. Once you’ve got a peer, peer exchange kicks in too.

PEX is a similar concept to DHT except there is no way of introducing a new peer to the swarm (users sharing a particular torrent) without first communicating via tracker or DHT. The method used in PEX involves your client asking all peers that you are connected to for the peers that they are connected to. PEX is no good from a cold start, but often provides better results than querying a tracker or swarm via DHT.

How Does This Affect Me?

Your world won’t be rocked by the switch from downloadable .torrent files to magnet links, though there are a few key differences. First up you’re going to need a magnet-compatible client, and there’s a very good chance you’re already using one. uTorrent, Vuze, BitComet, Transmission, Deluge and qBitTorrent all support magnet links, and most clients that are still being actively developed will probably add the functionality at some point.

The main complaint I see come up time and time again is the inability to select which files to download when adding a magnet link to your BitTorrent client. While this is true, it’s easy to change this once the torrent is on its way down.

Perhaps the question should be “how does it affect the tracker?” then, as it makes quite a difference on that end. For starters the lack of downloadable .torrent files saves on bandwidth, as all magnet links are embedded directly into the webpage. From the tracker’s perspective this removes much of the paper trail – after all, magnet links can be shared anyway you see fit. Find them on trackers, stick them in an email, IM or print them and send them as postcards – it makes very little difference as no “download” took place between you and (in this instance) The Pirate Bay.

Mirrors are also now a lot easier to organize, as the need to host downloadable files has been completely removed. This would in effect make it harder for copyright enforcers to curb piracy, even if the original web page with the magnet links is taken offline another is bound to spring up with the exact same content. Throw DHT into the mix and even if the tracking server is down people will still be able to share files.
What did we learn?

Magnet links mean more of a change for the trackers and index sites than they do for end users. The switch towards trackerless technology using existing foundations like DHT and PEX protects the trackers by eliminating that initial .torrent file download, being able to discover peers in a completely decentralised manner and of course making it very difficult to keep a site distributing magnet links down for long thanks to the easy mirroring procedure.

It seems that the cat-and-mouse game played between filesharing advocates and the copyright enforcers is far from over.

Have you switched to magnet links? Do you now avoid .torrent downloads? Any favorite trackers or clients? Have a shout about it in the comments, below.

No comments:

Post a Comment