Torrent file - Wikipedia
Torrent file
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article relies too much on references to primary sources. Please improve this by adding secondary or tertiary sources. (April 2010) (Learn how and when to remove this template message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Torrent file" – news ·newspapers · books · scholar · JSTOR(December 2018) (Learn how and when to remove this template message)
(Learn how and when to remove this template message)
In the BitTorrent file distribution system, a torrent file or meta-info file is a computer file that contains metadata about files and folders to be distributed, and usually also a list of the network locations of trackers, which are computers that help participants in the system find each other and form efficient distribution groups called swarms.[1] A torrent file does not contain the content to be distributed; it only contains information about those files, such as their names, folder structure, and sizes obtained via cryptographic hash values for verifying file integrity. The term torrent may refer either to the metadata file or to the files downloaded, depending on the context.
A torrent file acts like a table of contents (index) that allows computers to find information through the use of a Bittorrent client. A torrent file gives addresses identifying computers that can send parts of the requested file. With the help of a torrent file, one can download small parts of the original file from computers that have already downloaded it. These "peers" allow for downloading of the file in addition to, or in place of, the primary server.
Torrent files are normally named with the extension ".torrent".
Torrent files themselves and the method of using torrent files have been created to ease the load on central servers, as instead of sending a file to for request, it can crowd-source the bandwidth needed for the file transfer, and reduce the time needed to download large files. Many free/freeware programs and operating systems, such as the various Linux distributions offer a torrent download option for users seeking the aforementioned benefits. Other large downloads, such as media files, are often torrented as well.
Torrent files
Filename extension
Internet media typeapplication/x-bittorrent
Typically, Internet access is asymmetrical, supporting greater download speeds than upload speeds, limiting the bandwidth of each download, and sometimes enforcing bandwidth caps and periods where systems are not accessible. This creates inefficiency when many people want to obtain the same set of files from a single source; the source must always be online and must have massive outbound bandwidth. The BitTorrent protocol addresses this by decentralizing the distribution, leveraging the ability of people to network "peer-to-peer", among themselves.
Each file to be distributed is divided into small information chunks called pieces. Downloading peers achieve high download speeds by requesting multiple pieces from different computers simultaneously in the swarm. Once obtained, these pieces are usually immediately made available for download by others in the swarm. In this way, the burden on the network is spread among the downloaders, rather than concentrating at a central distribution hub or cluster. As long as all the pieces are available, peers (downloaders and uploaders) can come and go; no one peer needs to have all the chunks, or to even stay connected to the swarm in order for distribution to continue among the other peers.
A small torrent file is created to represent a file or folder to be shared. The torrent file acts as the key to initiating downloading of the actual content. Someone interested in receiving the shared file or folder first obtains the corresponding torrent file, either by directly downloading it, or by using a magnet link. The user then opens that file in a BitTorrent client, which automates the rest of the process. In order to learn the Internet locations of peers which may be sharing pieces, the client connects to the trackers named in the torrent file, and/or achieves a similar result through the use of distributed hash tables. Then the client connects directly to the peers in order to request pieces and otherwise participate in a swarm. The client may also report progress to trackers, to help the tracker with its peer recommendations.
When the client has all the pieces, the BitTorrent client assembles them into a usable form. They may also continue sharing the pieces, elevating its status to that of seeder rather than ordinary peer.
File structure
A torrent file contains a list of files and integrity metadata about all the pieces, and optionally contains a list of trackers.
A torrent file is a bencoded dictionary with the following keys (the keys in any bencoded dictionary are lexicographically ordered):
All strings must be UTF-8 encoded, except for pieces, which contains binary data.
A torrent is uniquely identified by an infohash, a SHA-1 hash calculated over the contents of the info dictionary in bencode form. Changes to other portions of the torrent does not affect the hash. This hash is used to identify the torrent to other peers via DHT and to the tracker. It is also used in magnet links.
A torrent file can also contain additional metadata defined in extensions to the BitTorrent specification.[2] These are known as "BitTorrent Enhancement Proposals." Examples of such proposals include metadata for stating who created the torrent, and when.
Draft extensions
These extensions are under consideration for standardization.
Distributed hash tables
BEP-0005[3] extends BitTorrent to support distributed hash tables.
A trackerless torrent dictionary does not have an announce key. Instead, a trackerless torrent has a nodes key:
{ # ... 'nodes': [["<host>", <port>], ["<host>", <port>], ...], # ...}
For example,
'nodes': [["", 6881], ["your.router.node", 4804]],
The specification recommends that nodes "should be set to the K closest nodes in the torrent generating client's routing table. Alternatively, the key could be set to a known good node such as one operated by the person generating the torrent."
Multiple trackers
BEP-0012[4] extends BitTorrent to support multiple trackers.
A new key, announce-list, is placed in the top-most dictionary (i.e. with announce and info)
{ # ... 'announce-list': [[​'<tracker1-url>'​][​'<tracker2-url>'​]], # ...}
HTTP seeds
BEP-0017[5] extends BitTorrent to support HTTP seeds.
A new key, httpseeds, is placed in the top-most list (i.e. with announce and info). This key's value is a list of web addresses where torrent data can be retrieved:
{ # ... 'httpseeds': [​''​, ''​], # ...}
Private torrents
BEP-0027[6] extends BitTorrent to support private torrents.
A new key, private, is placed in the info dictionary. This key's value is 1 if the torrent is private:
{ # ... 'private': 1, # ...}
Private torrents are to be used with a tracker; decentralized methods like DHT, PeX, LSD are disabled to maintain the centralized control. A private torrent can be manually edited to remove the private flag, but doing so will change the info-hash, forming a separate "swarm" of peers.
Merkle trees
BEP-0030[7] extends BitTorrent to support Merkle trees. The purpose is to reduce the file size of torrent files, which reduces the burden on those that serve torrent files.
A torrent file using Merkle trees does not have a pieces key in the info list. Instead, such a torrent file has a root_hash key in the info list. This key's value is the root hash of the Merkle hash:
{ # ... 'info': { # ... 'root hash': <binary SHA1 hash>, # ... }, # ...}
Single file
Here is what a de-bencoded torrent file (with piece length 256 KiB = 262,144 bytes) for a file debian-503-amd64-CD-1.iso (whose size is 678 301 696 bytes) might look like:
{ 'announce': ''​, 'info': { 'length': 678301696, 'name': 'debian-503-amd64-CD-1.iso'​, 'piece length': 262144, 'pieces': <binary SHA1 hashes> } }
Note: pieces here would be a 51 KiB value (
Multiple files
Here is what a de-bencoded torrent file (with 'piece length' 256 KiB = 262144 B) for two files, 111.txt and 222.txt, might look like:
{ 'announce': ''​, 'info': { 'files': [ {'length': 111, 'path': ['111.txt']}, {'length': 222, 'path': ['222.txt']} ], 'name': 'directoryName', 'piece length': 262144, 'pieces': <binary SHA1 hashes> } }
See also
  1. ^ a b "BEP-0003: The BitTorrent Protocol Specification". Retrieved 2009-10-22.
  2. ^ "BEP-0000: Index of BitTorrent Enhancement Proposals". Retrieved 2009-10-22.
  3. ^ "BEP-0005: DHT Protocol". Retrieved 2009-10-22.
  4. ^ "BEP-0012: Multitracker Metadata Extension". Retrieved 2009-10-22.
  5. ^ "BEP-0017: HTTP Seeding". Retrieved 2009-10-22.
  6. ^ "BEP-0027: Private Torrents". Retrieved 2009-10-22.
  7. ^ "BEP-0030: Merkle hash torrent extension". Retrieved 2009-10-22.
External links
Official BitTorrent Specification
Last edited on 5 May 2021, at 01:31
Content is available under CC BY-SA 3.0 unless otherwise noted.
Privacy policy
Terms of Use
HomeRandomNearbyLog inSettingsDonateAbout WikipediaDisclaimers