Sie sind auf Seite 1von 43

The BitTorrent Protocol

What is BitTorrent?
Efficient content distribution system using file swarming. Usually does not perform all the functions of a typical p2p system, like searching.

http://www.cs.uiowa.edu/~ghosh/bittorrent.ppt

Bram Cohen in 2001 Designed to transfer large files 160 million clients, 100 million active users Used by many different people and organisations

Peer-to-peer in nature Central server called a tracker Tracker uses HTTP Download and upload at the same time Efficiency improves the more a file is downloaded

Bit Torrent Application

By David Hannaford

Application
Is used to send and receive large files of any type including but not limited to Video, audio, executable files and images. Streaming (or progressive downloading) is currently not supported by the Bit Torrent protocol due to fact that torrents are downloaded in a non-sequential data transfer downloading the rarest file part first (section of file between 32kb and 4MB).

Application
Bit Torrent Activities: Download a torrent (become a leacher) Have another servent download from you (seeder) Publish by creating a .torrent file and uploading onto tracker

Start Torrent Client

Start Torrent Client

Bit Torrent Download

Bit Torrent Download

Bit Torrent Upload

Uploading
Once the Torrent Client is started, it is possible for other servents to download from you. Uploading is shown in main screen, it is necessary to allow uploads as this will prevent throttling inherent in the Bit Torrent protocol.

Publish Torrent File

Publish Torrent File


File is converted in .torrent file using Torrent Client.

Publish Torrent File


Can upload to a torrent specific site tracker so other piers can find and download your torrent.

Publish Torrent File


DONE! Now anyone with Torrent Client can download this File.

Bit Torrent how it works


M Hunter 01/03/2011

A *.torrent guides users to owners of a file


User obtains *.torrent file. File contains meta info about a target file. This includes suggested names of file pieces & their lengths, SHA-1 hash tags used to help verify that pieces received are correct, and the URL address of a tracker Armed with a 4 list of peers User loads *.torrent holding pieces file into BitTorrent of the file, user client, which then downloads from looks up the named many peers client 1

3 The client holds a list of peers that are participating in the torrent and supplies this list

All peers act as a source


A machine with a complete copy (the seed) can distribute incomplete pieces to multiple peers

Seed

Peers exchange different pieces of the file with one another until they assemble a whole

As soon as the user has a piece of the file on his machine, he can become a source of that piece to other peers, helping speed

The key ingredients of the *.torrent file are the trackers address and the unique SHA1 hash
All data in a metainfo file is bencoded. info: a dictionary that describes the file(s) of the torrent. announce: contains the URL of the tracker creation date Comments from the author(optional) created by: (optional) piece length: number of bytes in each piece (integer) pieces: string consisting of the concatenation of all 20byte SHA1 hash values, one per piece private: (optional) is a field where the client requests to avoid publicising its request beyond trackers the filename

http://wiki.theory.org/BitTorrentSpecification

Tracker hands out addresses of peers and seeds


Client->Tracker requests
These are the key parameters sent in the HTTP(S) GET request from the client to the tracker. Info_hash: urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file. Peer_ID: a unique ID for the client, generated by the client at startup. port: Port # the client is listening on. event: If specified, must be one of started, completed, stopped Uploaded, downloaded and left: The total amount uploaded/ downloaded/ left since the client sent the 'started' event to the tracker IP: Optional. The true IP address of the client machine (needed particularly if client and seed are on the same NAT)

Tracker->Client response
The tracker responds with a text document which contains the following key features: failure reason and/or warning message: If present, then no other keys may be present. The value is a human-readable error message as to why the request failed (string). interval: Interval in seconds that the client should wait between sending regular requests to the tracker tracker id: A string that the client should send back on its next announcements complete: number of peers with the entire file, i.e. seeders (integer) incomplete: number of nonseeder peers, aka "leechers" (integer) peers: (dictionary model) The value is a list of dictionaries,

http://wiki.theory.org/BitTorrentSpecification

When peers are interested and not choking each other, data is exchanged
Peers start communications with a handshake The handshake is a required message and must be the first message transmitted by the client.
Contains identifiers of the protocol in use, the peer ID and the SHA1 hash of the file being chased If a client receives a handshake with an info_hash that it is not currently serving, then client drops connection.

Each client keeps track of whether it is CHOKING and/or INTERESTED in remote peers
Am choking Peer choking Peer not choking Peer interested Block uploaded Block downloaded Am not choking Am interested

Ongoing message are then exchanged to facilitate transfer. Other messages that are exchanged include keep alive as clients maintain regular contact to stay active, and Have which is the vital message that a peer has a particular piece of a file http://wiki.theory.org/BitTorrentSpecification

Peers choose to choke one another based on self-interest and self-interested charity
Object of good choking algorithm Should cap # of simultaneous uploads for good TCP performance. Should reciprocate to peers who let it download. No fibrilation:Should avoid choking and unchoking quickly Should try unused connections once in a while to find out if they might be better than the currently used ones Bit Torrent toggles only once per 10 seconds For optimistic unchoking, at any one time there is a single peer which is unchoked regardless of its upload rate . Rotates every 30 seconds. New guys entering the game get 300% chance of being OU to help them get started. How BitTorrent works 4 Peers with best upload rate get prioritisation

http://wiki.theory.org/BitTorrentSpecification

Comparison
Comparison carried out by downloading Open Office 3.3. File available to download from http://www.openoffice.org/ Straight download took < 20 mins. MD5 Checksum available to verify download.

BitTorrent
Transmission BitTorrent Client. Version 3.3 not available from official source. Older version downloaded for comparison. (similar file size approx 150MB). Max 57 peers during download. Download took approx 45 mins. Power cut half way through.

BitTorrent
Version 3.3 found on unofficial site. 3 peers sharing. Download took approx 25 mins. No checksum available to verify file.

Points
BitTorrent provided slower download on this occasion. Trust issue. File availability. Robust. Benefit to distributor. Personal data usage was doubled.

Bittorrent performance Performance in comparison with http downloads:

Http: Guaranteed availability, constant bandwitdth, sequential downloads using one TCP connection via port 80
Bittorrent: Availability is not guaranteed, slow initial speed, many TCP connections via many ports, more resilient, cheap

Hard factors: Size of the swarm, swarm dynamics and the total bandwidth Health of the files being shared (Seeder / leecher ratio) Willingness of peers to share

Soft factors:
Coordinating protocols applied by trackers Policies of sharing applied by users / bittorrent clients

Availability

Coordinating protocols determine which piece will be served to which peer. (random / rarest first / superpeer) Private hosts / trackers

Speed Distributed Hash Table (DHT) Peer exchange Local Peer Discovery Protocol Encryption, Half-Open Connections and uTP UDP Packet Protocol to circumvent ISP throttling Capping Upload Speed Tit for tat - assures reciprocity between downloading and uploading rates Optimistic unchoking gives chance to newcomers

BITTORREN T

AND THE LAW

The analysis of Bittorent has revealed four distinct concepts:

1. The BITTORENT protocol 2. The BITTORENT client program


3. *.TORRENT metafiles/trackers 4. Content files Each involves different issues

1. The BITTORENT protocol (the technology) - No laws against file-sharing


standards

2. The BITTORENT client program


- Similarly, the client software does not do anything illegal

3. *.TORRENT metafiles/trackers
- A grey area

4. Content files

- It is illegal to use Bittorent to download and upload copyright material

There have been several closures of tracker sites in recent years: 2004: 2004: 2005: 2005: Finreactor Bittorent site shut down by police Suprnova.org shut down by Slovenian authorities EliteTorrents.org shut down by F.B.I. Bittorent up loader in Hong Kong faces criminal charges

3. *.TORRENT meta2006: The Pirate Bay.org raided by Swedish police. Charges files/trackers
- A grey area currently being appealed.

2010: The US Copyright Group begins to acquire IP address of those using Bittorrent to download certain movies.

Should the trackers be punished for tracking only meta-files?

And security is a concern

Technology vulnerable to automated spam

Servers can suffer DoS attacks

Ideal for spreading spyware