Torrent. Raise your BitTorrent tracker

 

Torrent. Raise your BitTorrent tracker

internet-technologies.ru
12 min
July 26, 2022

You don’t have to tell what Torrent / Torrent is, even those who have never heard of html in their lives and think that sites are “burned” by the gods, download music, movies or programs from torrents (not “quite” legally).

150 million users in the world is the best proof that the system works and is incredibly popular. After all, finding and downloading something with a torrent is much easier than searching the net (and often not finding it).

The BitTorrent protocol is the very case when you want to say "everything ingenious is simple." And the truth! Despite universal recognition and a multi-million army of users, the protocol itself contains the most “native” principles, such as “I to you - you to me”. And at the same time, this is not just a peer-to-peer network, where users upload files shared (open for download) from each other, without fail standing in line waiting until the coveted slot is finally free for them. On the contrary, it is a technology that allows you to get the file as quickly as possible - often faster than just downloading it from an HTTP server (although often quite the opposite). An important role here is played by the so-called torrent trackers, which were originally intended only as coordinators of the process of transferring files between users, but subsequently turned into information portals about shared files with wild popularity. Having understood the internal organization of the BitTorrent protocol, you can launch the tracker yourself. Then - to promote and effectively use for their own purposes. So, let's begin?

General Principles of the Protocol
In order not to jump right off the bat, I propose to first analyze the general principles of the BitTorrent technology. The protocol was first introduced to the public on July 2, 2001, when programmer Bram Cohen published its first implementation in Python. There are now a huge number of clients that are used by more than 150 million BitTorrent users around the world. There are several reasons for this popularity:

  • the highest operating speed compared to other peer-to-peer networks;
  • no queues, almost instant start of downloads;
  • the ability to view detailed information about the downloaded file (for example, for a music album - this is information about the bitrate, tracklist, log file of the ripper program, cover), thanks to information sites where torrents are posted;
  • the ability to download files in parts;
  • files are distributed directly between users, servers only coordinate the process of connecting and transferring files.

To exchange files, the user needs the so-called BitTorrent client - a program that implements the BitTorrent protocol. To download any file, you must first find a so-called torrent file for it, which contains special metadata inside. Firstly, this is information about the file itself (its hash sum) and, secondly, the coordinates of the so-called tracker - the server computer that coordinates the distribution of the file. A torrent file can store information about not one, but many files at once, maintaining a complex folder hierarchy.

After reading the metadata from the torrent file, the client connects to the tracker and tells it its address and the hash sum of the requested file. To which, in response, it receives the addresses of other peers downloading or distributing the same file. The client connects to them and immediately exchanges information about the existing file segments. If one of the peers is ready to give the necessary parts, the download begins. After at least one segment is downloaded, the client checks its checksum and notifies all connected peers that it has this segment. The process continues until the file is completely downloaded.

It turns out that clients connect with each other, exchange without the direct participation of the tracker, which only regularly updates information about peers connected to the exchange and other statistics. For the BitTorrent network to work effectively, it is necessary that as many clients as possible be able to accept incoming connections. They need to have the following TCP ports open: 6881-6889. However, they can be changed if necessary, in order to bypass firewall restrictions, for example.
What is inside a torrent file?

As already mentioned, for the distribution of any file, a metadata file is necessarily created, which contains the following information:

  • general information about the uploaded file (name, length, etc.);
  • checksums of segments of the uploaded file;
  • Tracker URL.

Naturally, you do not need to do anything manually. All the work is done by a special program included in any modern torrent client. It is she who breaks the file into parts, ranging in size from 64 to 4 MB. For each of the pieces, a checksum is calculated (using the SHA-1 algorithm) and written to a torrent file with other metadata. I must say that checksum calculation is an integral part of the protocol: as soon as a user downloads a segment of a file, he immediately checks the real and declared checksum. Thus, the absence of errors at any stage of the download is ensured. Once created, the torrent file is uploaded to a public place so that other users can find it - usually these are websites associated with the tracker.
Let's talk about trackers

Despite the fact that the tracker coordinates the exchange of files between clients, it often does not even know what files are transferred through it. After all, when peers refer to it, they do not indicate names or even descriptions, but only pass hash sums that say nothing. On the other hand, trackers have long ceased to be an exclusively technical component necessary to work with the system. Almost all of them now have a special web interface with additional features. Distribution statistics individual for each user, the current number of seeds and peers for each torrent, the total amount of data transferred between clients ... have long become standard features of any torrent tracker. And most importantly, such an interface is used as a platform for storing and publishing new torrent files.

Tracker access can be public or private. In connection with the emergence of a large number of freeloaders or, in other words, leechers, uploading a huge number of files, but without giving anything away, the so-called private trackers appeared. Access to this is only after registration, which is often possible only at the invitation of an already registered user. To identify a particular client, the tracker uses either the user's IP address or a unique password for each user, added by the tracker to the torrent file when downloading it. A feature of private trackers is a special rating system that takes into account the amount of data transferred to other peers and downloaded to oneself. Tracker administrators require some minimum ratio of the two to be maintained. As a result,
Choosing a tracker

There are different implementations of torrent trackers, but the main language in which such software is currently being developed is PHP! One of the most common, of course, is TBDev / TBSource and its various modifications, which are distributed in large numbers over the Web (of course, because it costs nothing to customize a PHP script for yourself). In particular, such popular trackers as what.cd and waffles.fm “spin” on this engine. In addition, I managed to come across other implementations of PHP trackers: BtiTracker, xbtit, AKNova, TorrentTrader. All of them require a PHP interpreter installed on the server and use the MySQL DBMS as data.

Another part of the trackers, which appeared much earlier, was written in compiled languages. These include:

  • XBTT is a well-known tracker, the first version of which appeared back in 2004, but development and support are still ongoing;
  • BNBT is a C++ port of Bram Cohen's original that was developed in Python. BNBT itself, as well as its two forks CBTT and XBNBT, are unfortunately no longer being developed;
  • Opentracker, which was once used by The Pirate Bay before the problems with record label associations.

If you choose not from scripted trackers, then the choice will obviously fall on XBTT and Opentracker, however, I do not recommend contacting them for a number of reasons. At first, it is best to use PHP implementations - TBDev / TBSource or xbtit. As an example, we will take the TBDEV YSE modification, which can be downloaded from bit-torrent.kiev.ua or taken from our disk.
Let's start installation

So what do you need to install?

  1. PHP-enabled web server (such as Apache or LightTPD);
  2. PHP version 5.1.1 or higher;
  3. MySQL database server version 4.1 or higher, 5.0 is better;
  4. Any shell for working with MySQL DBMS (for example, phpMyAdmin or EMS SQL Manager 2007 Pro for mySQL).

The requirements are so minimal that even free hosting is suitable for hosting a torrent tracker. However, the likelihood that your torrent will soon fail or be deleted altogether is very high. Therefore, do not be stingy to spend money on a paid site: at first, the most common hosting will do, the price of which does not exceed $10-15. If things go well and the tracker will gain momentum, you can think about VPS / VDS and, ultimately, a dedicated server. The only subtle nuance is the PHP interpreter settings:

  • memory_limit = 16M
  • error_reporting = E_ALL ^ E_NOTICE
  • display_errors = On
  • display_startup_errors = On
  • log_errors = On
  • report_memleaks = On
  • short_open_tag = On
  • register_globals = Off
  • magic_quotes_gpc = Off
  • file_uploads = On
  • upload_max_filesize = 8M
  • allow_url_fopen = On

If everything is OK, you can proceed with the installation. After unpacking the archive with scripts, pay attention to the SQL folder, which contains one single database.sql file - with its help you can create a database with the desired structure. What are we going to do now.

1. Almost any hosting has a phpMyAdmin script, specially designed for convenient database management through a browser. You can access it like this: http://<resource url>/phpmyadmin/ or from the admin panel (Plesk, cPanel, DirectAdmin or another, depending on the hosting - the essence is the same for everyone). In extreme cases, it costs nothing to install it yourself.

2. Next, create a new database, specify its name (say, tbdev), and select the cp1251_general_ci encoding as the "Comparison" parameter. Click "Create".

3. Go to the "Import" tab. It may turn out that there is no such tab - then a tab with the name SQL will do. One way or another, you will be prompted to specify an SQL file containing a sequence of SQL commands.

4. Click on the "Browse" button and specify the path to our SQL file. Not forgetting to select cp1251, we give the import command.

5. Now we need to specify the parameters of the database and the SQL server itself to our scripts. To do this, go to the /include folder and edit the following parameters in the secrets.php file:

That's it, now the tracker files can be uploaded to the server. The scripts are written in such a way that nothing else needs to be configured. It is enough to type in the address bar of the browser the path to the newly downloaded scripts, and the page of your own tracker will appear in front of you! The first registered user automatically becomes an administrator, who can manage tracker settings, delete and edit accounts, moderate the internal forum, etc., etc. In a word, to do everything so that the tracker serves for the benefit of society. It would be superfluous to describe the features of the work, in view of the simplicity of the whole process. I will only note that some of the settings that affect the behavior of the tracker are also in the secrets.php file.

Overview of torrent trackers

Torrents (http://torrents.ru)

One of the largest Russian trackers. About 160 thousand users visit it daily, which is very good for a project based on pure enthusiasm. It is worth noting that it became so popular in a relatively short time period - only three years. Among the main advantages are: a large amount of diverse content (from rare audio and video recordings to fresh builds of software products) and high download speed due to a large number of peers.

Demonoid (http://Demonoid.com)

The largest tracker in the world, which has been declared a real war by the association of sound recording companies. Not so long ago, when the Demonoid disappeared for several months, it seemed that they had won this war. However, in the spring the server came to life again and feels great on the Ukrainian sites. Registration requires an invitation from one of the users.

NovaFilm (http://novafilm.tv)

NovaFilm is a community that specializes in translating and dubbing popular TV shows (mainly series). They arrange all their releases in the form of distributions on the tracker of the same name. The peculiarity of "NovaFilm" is the exclusivity and good quality of the content. New episodes of popular series appear a day or two after their premiere over the hill. Thanks to this promptness, novaFilm.tv has become the number one tracker for all fans of new and old TV series.

The best series (http://lostfilm.ru)

LostFilm can safely be called a mirror of NovaFilm. Why? Yes, because this is another tracker entirely dedicated to the distribution of popular TV shows. Fans of series have long had a custom - if the desired series is not found on novafilm, it means that it will certainly be found on lost'e.

HD Tracker (http://hdtracker.ru)

The main content of this tracker is new movies in HD DVD, Blu-ray and HDTV formats. The main visited resource - movie lovers with good image quality and the widest Internet channel. Mere mortals with a slow Internet on this tracker have nothing to do, since the average size of a movie, as a rule, is not less than 4 gigs, which means that with a channel thickness of 64/128 KBit, nothing can be quickly pulled off. Oh yes, I almost forgot. To register, you must receive an invitation from one of the users of the resource.

Sharereactor (http://tracker.sharereactor.ru/)

Pretty good and "live" tracker. Of the content, only video is presented here. Moreover, there are both new items and rather old and rare films. Many of the releases can be called exclusive, because regular visitors of the resource are engaged in the creation of voice acting. It is only thanks to such enthusiasts that many can watch a film that has not yet been officially dubbed in the Russian Federation (and it is possible that it will not be ...), and there are very, very many such films.

TFile (http://tfile.ru/)

A large torrent tracker, which can be compared with torrents.ru in terms of the number of users and the volume of content provided (although it is still far from being a full-fledged torrents.ru). The content on the tracker is the most diverse: new films, films in HDTV quality, series, soft, cartoons, anime, literature, etc. Of the features can be identified - the stability and spiritual atmosphere that prevails at the forum. The stability of the work is really on top. A tracker of this magnitude rarely goes down and is always glad to see new guests. Among the minuses, one can note a fairly quick “cooling down” of hands.

Free Exchage (http://tracker.freeexchange.ru)

One of the few trackers that allows you to download files without registration and without any restrictions. At first glance, this is good, but if you look from the other side, then there is more bad. The lack of registration gives rise to freeloaders who only download and give absolutely nothing. As a result, new items on the tracker appear not only promptly, and distributions do not last long.

The Pirate Bay (http://thepiratebay.org)

One of the largest trackers in the world both in terms of the number of users and content. Content for every taste. There are games, and movies, and everything your heart desires. Moreover, the visitor is not required to register and perform complex body movements - you can immediately proceed to the download. Due to the large number of users, the download speed is always at a high level, so both owners of wide Internet channels and very narrow ones will be happy.

Torrent Finder (http://torrent-finder.com)

This is not a torrent tracker, but a specialized search engine for torrent files. With the help of this service it is very convenient to look for some exclusive things. I typed in a request, waited a few seconds, and voila - a bunch of links to a torrent file with a similar name. Torrent Finder searches for the largest foreign trackers, but, unfortunately, bypasses domestic resources.

Comments