Skip to content
piracywatch.io
Sign inContact

Pieces, hashes and choking in BEP 3

Data integrity in the BitTorrent protocol relies on a system of verification. According to BitTorrent.org BEP 3, a file is split into fixed-size pieces, with a SHA-1 hash for each piece listed in the .torrent file. If a piece fails this hash check, it is discarded and fetched again.

The Info-Hash

To identify a specific torrent, the protocol uses an info-hash. BitTorrent.org BEP 3 defines this as the SHA-1 hash of the encoded info section. This unique identifier allows clients to ensure they are requesting the correct set of pieces from other peers.

Tracker Exchange

The tracker serves as a coordination point for peers. According to BitTorrent.org BEP 3, the tracker provides each client with a list of other available peers. In return, the tracker receives specific metrics from the client: the count of bytes uploaded, the count of bytes downloaded, and the count of bytes still needed.

The Choking Algorithm

BitTorrent is designed to distribute the upload load away from the original source. Peers upload to one another while they download. To manage this, the protocol employs a choking algorithm to prioritize efficient peers.

According to BitTorrent.org BEP 3, clients favor peers that send data back. A client typically keeps about four peers unchoked at any given time. To discover new potential partners, the protocol rotates one optimistic unchoke slot every 30 seconds.

Seeding

The process of sharing continues after a client has acquired all pieces of a file. BitTorrent.org BEP 3 states that clients that finish downloading keep uploading to other peers until the user manually stops them. This state is known as seeding.

Implications for Measurement

The distinction between peer communication and tracker communication is critical for data analysis. While peers exchange the actual file pieces, the tracker only sees the metadata reported by the clients. According to BitTorrent.org BEP 3, the tracker receives counts of bytes uploaded, downloaded, and needed, but it does not see the content itself.

Sources