SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Introduction to the BitTorrent Protocol Tommy Montgomery // March 2, 2010
What is BitTorrent?
What is BitTorrent? NOT illegal
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
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
How does it work?
How does it work:  Consumer Download torrent:  lots-o-cool-stuff-n-things.lulz.torrent Open it in your favorite client:
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
Glossary
Glossary Seeder
Glossary Seeder Someone who has finished downloading and is only uploading
Glossary Seeder Someone who has finished downloading and is only uploading Leecher
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer The collective term for seeders and leechers
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
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
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 + “:”
Bencoding d3:foo3:bar4:lulzi8el5:hello5:worldee
Bencoding d3:foo3:bar4:lulzi8el5:hello5:worldee ,[object Object],[object Object]
String,[object Object]
String
Integer,[object Object]
String
Integer
List,[object Object]
Trackers HTTP service that responds to GET requests Response is text/plain Bencoded dictionary Usually listens on port 6969
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
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
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
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
Tracker Implementation PHP/MySQL/Apache Why not?
First, of course… We need a Bencoding library. Let’s roll our own.
yay.
It’s tracker time We need a way to keep track of peers, and who’s downloaded what and stuff Let’s use MySQL
It’s tracker time Request is pretty boring, as it’s just a glorified array with error handling
It’s tracker time Response is a Bencoded dictionary, and is also a glorified array
It’s tracker time Now we can set up an exception handler that will send a proper response back in the event of a catastrophe
It’s tracker time Now we can make the tracker announce the peers
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
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
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

Weitere ähnliche Inhalte

Was ist angesagt?

Bit Torrent presentation
Bit Torrent presentationBit Torrent presentation
Bit Torrent presentation
Avula Jagadeesh
 
Torrent Protocol
Torrent ProtocolTorrent Protocol
Torrent Protocol
Harsht2888
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
balu0503
 
Bit torrent documentation
Bit torrent documentationBit torrent documentation
Bit torrent documentation
Avula Jagadeesh
 

Was ist angesagt? (20)

Bit Torrent presentation
Bit Torrent presentationBit Torrent presentation
Bit Torrent presentation
 
Bit torrent-technology
Bit torrent-technologyBit torrent-technology
Bit torrent-technology
 
Bit torrent protocol by milan varia
Bit torrent protocol by milan variaBit torrent protocol by milan varia
Bit torrent protocol by milan varia
 
Bit torrent Technology ppt
Bit torrent Technology pptBit torrent Technology ppt
Bit torrent Technology ppt
 
Torrent
TorrentTorrent
Torrent
 
UNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENTUNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENT
 
Bit Torrent
Bit Torrent Bit Torrent
Bit Torrent
 
Bit torrent
Bit torrentBit torrent
Bit torrent
 
Torrent Protocol
Torrent ProtocolTorrent Protocol
Torrent Protocol
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent protocol
Bit torrent protocolBit torrent protocol
Bit torrent protocol
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
 
Bit Torrent Protocol Report
Bit Torrent Protocol ReportBit Torrent Protocol Report
Bit Torrent Protocol Report
 
Torrent technology
Torrent technologyTorrent technology
Torrent technology
 
Bittorrent final seminar
Bittorrent final seminarBittorrent final seminar
Bittorrent final seminar
 
Bit torrent documentation
Bit torrent documentationBit torrent documentation
Bit torrent documentation
 
Torrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, detailsTorrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, details
 
BitTorrent Seminar Report
BitTorrent Seminar ReportBitTorrent Seminar Report
BitTorrent Seminar Report
 
Torrents
TorrentsTorrents
Torrents
 

Ähnlich wie Introduction to the Bittorrent Protocol

The big book of bit torrent
The big book of bit torrentThe big book of bit torrent
The big book of bit torrent
gkmv
 
Bit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay RBit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay R
Sanjay Ravishankar
 
P2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution SystemsP2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution Systems
Lorin Olsen
 
P2P Seminar
P2P SeminarP2P Seminar
P2P Seminar
CoRehab
 
Bit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONSBit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONS
ssanda3
 
Bit Torrent Protocol
Bit Torrent ProtocolBit Torrent Protocol
Bit Torrent Protocol
Ali Habeeb
 

Ähnlich wie Introduction to the Bittorrent Protocol (20)

The big book of bit torrent
The big book of bit torrentThe big book of bit torrent
The big book of bit torrent
 
Bit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay RBit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay R
 
Aditya Pathak
Aditya PathakAditya Pathak
Aditya Pathak
 
P2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution SystemsP2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution Systems
 
Bittorrent_project_Srikanth_Vanama
Bittorrent_project_Srikanth_VanamaBittorrent_project_Srikanth_Vanama
Bittorrent_project_Srikanth_Vanama
 
(130316) #fitalk bit torrent protocol
(130316) #fitalk   bit torrent protocol(130316) #fitalk   bit torrent protocol
(130316) #fitalk bit torrent protocol
 
Bit torrent protocol
Bit torrent protocolBit torrent protocol
Bit torrent protocol
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent and tracker
Bit torrent and trackerBit torrent and tracker
Bit torrent and tracker
 
P2P Seminar
P2P SeminarP2P Seminar
P2P Seminar
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent
Bit torrentBit torrent
Bit torrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONSBit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONS
 
Peer to Peer networks and piracy
Peer to Peer networks and piracyPeer to Peer networks and piracy
Peer to Peer networks and piracy
 
BitTorrent.pdf
BitTorrent.pdfBitTorrent.pdf
BitTorrent.pdf
 
Bit Torrent Protocol
Bit Torrent ProtocolBit Torrent Protocol
Bit Torrent Protocol
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Introduction to the Bittorrent Protocol

  • 1. Introduction to the BitTorrent Protocol Tommy Montgomery // March 2, 2010
  • 3. What is BitTorrent? NOT illegal
  • 4. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer
  • 5. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
  • 6. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
  • 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
  • 8. How does it work?
  • 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
  • 13. Glossary Seeder Someone who has finished downloading and is only uploading
  • 14. Glossary Seeder Someone who has finished downloading and is only uploading Leecher
  • 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 + “:”
  • 22.
  • 23.
  • 25.
  • 28.
  • 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
  • 35. First, of course… We need a Bencoding library. Let’s roll our own.
  • 36.
  • 37. yay.
  • 38. It’s tracker time We need a way to keep track of peers, and who’s downloaded what and stuff Let’s use MySQL
  • 39.
  • 40. It’s tracker time Request is pretty boring, as it’s just a glorified array with error handling
  • 41. It’s tracker time Response is a Bencoded dictionary, and is also a glorified array
  • 42.
  • 43. It’s tracker time Now we can set up an exception handler that will send a proper response back in the event of a catastrophe
  • 44. It’s tracker time Now we can make the tracker announce the peers
  • 45.
  • 46.
  • 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.