7. Poppycock! BitTorrent historically has a bad reputation, due to its decentralized method of file transfer This makes it difficult to “remove” a download, such as one that is illegal BitTorrent is not inherently evil People are inherently evil I like bullet points
9. How does it work: Consumer Download torrent: lots-o-cool-stuff-n-things.lulz.torrent Open it in your favorite client:
10. How does it work Files are downloaded piecemeal, from many different places instead of just one Trackers are the central hub of control for each torrent Each tracker manages your “peers”, which are other people who are trying to download the same file
15. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading
16. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer
17. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer The collective term for seeders and leechers
18. What is a torrent file? A Bencoded metadata file containing information about one or more files Name/size/date of each file # of “pieces” of each file SHA1 hash of each piece Trackers for the torrent
19. What is a “piece”? Torrents are made up of many small pieces You never download all the pieces from one place (unless there’s only one seed) Pieces are usually less than a couple megabytes each
20. Bencoding Dictionaries Prefixed with “d”, end with “e” Lists Prefixed with “l”, end with “e” Integers Prefixed with “i”, end with “e” Strings Prefixed with string length + “:”
29. Trackers HTTP service that responds to GET requests Response is text/plain Bencoded dictionary Usually listens on port 6969
30. Tracker Announce Request Usually has a billion GET params: info_hash peer_id port uploaded downloaded left compact no_peer_id event ip numwant key trackerid
31. Tracker Announce Request Important GET params: info_hash the SHA1 hash of the piece to download peer_id unique identifier of the person doing the downloading ip/port the IP address and port of the peer uploaded/downloaded/left used for calculating “share ratio”, i.e. how much the tracker likes them
32. Tracker Announce Response A Bencoded dictionary with these keys: complete incomplete tracker id (yes, that is a space) peers warning message failure reason (only if an error occurred) interval min interval
33. Tracker Announce Response The relevant parts: peers Dictionary containing each peer’s IP address and port Or, if the client wants it compact, a binary string of each peer’s IP address and port interval/min interval the interval in seconds which the client is allowed to make a request complete/incomplete number of seeders/leechers
47. Set up the torrent Now, stuff your tracker on a server somewhere, listen on port 6969 Then add your tracker’s announce URL to a torrent e.g. http://likeaboss.biz:6969/announce
48. Other stuff Trackers are also facilitators and the supreme overlords over the torrents they track The list of peers that gets sent back to the client determines who downloads from whom They will use download/upload statistics to determine who isn’t uploading/seeding, and punish them by giving them crappy peers
49. Open source trackers OpenTracker (used by what’s left of The Pirate Bay) XBT Tracker – implemented using UDP instead of HTTP for ultimate efficiency MonoTorrent – cross-platform C# implementation (client as well) PeerTracker – PHP 5 implementation
50. In short… Unless you want to implement some weird rules for who gets to download stuff, don’t write your own. I only did it for fun. Because it’s fun.