How Torrents Work?!
Tags: 100daysofcode, torrent, codenewbie, computerscience
Published: 2022-02-23 16:19:53

### **What is Torrent?**
In the computing sector, the term "torrent" usually refers to a computer file that has metadata including numerous pieces of information. The extension ".torrent" is usually associated with a torrent file, however it does not include the actual content to be transferred.
 
This works as a peer-to-peer (P2P) network. Users can share files without uploading them to a server using peer-to-peer (P2P) file sharing. Trackers—programs that coordinate the transport of torrents—are told where to receive torrent files by the file name extension or metadata.

This information will then be used by BitTorrent software like uTorrent, Transmission, or BitTorrent for "real" distribution, allowing users to effortlessly download torrent files to their machines.

### **How Torrents work?**
The torrent file serves as a key to start the actual content download. When someone wants to get a shared file (such as books, music, or papers), they must first get the appropriate torrent file - either by downloading the.torrent file directly or by using a magnet link.

To open this file/link, you'll need BitTorrent software or uTorrent (basically any trusted torrent software you can download). After the BitTorrent programme has scanned the torrent file/link, it will need to locate seeders who are sharing the same file. To do so, it will attempt a direct connection with a list of defined trackers (found in the torrent file metadata). If all goes well, the necessary content will begin to transmit.

A torrent download is done in chunks, so you're actually downloading bits and pieces of the whole file from seeders, which will be reassembled once all of the bits and pieces have arrived.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tq4lrwo25x5bf354y1ge.png)

 
### **What is a Magnet URL?**
A magnet link is a form of hyperlink that allows users to download files and data from peer-to-peer (P2P) networks, especially torrent networks. It operates without the use of a server and provides all of the information that a torrent client needs to download a given file.

The magnet link was created to replace and update the requirements of torrent files.

**While downloading torrent we see few terms like "Seeds", "Peers", "Leaches" and more, Lets understand them one by one.**

### **What is a Seed?**
The seed is the user who has already downloaded the entire file and is now sharing it with peers without downloading any pieces of it from others.

### **What is a Peer?**
As we know files are downloaded chunks. So, When a user downloads some content, he immediately begins uploading it. If there are more users active in the process, the file will be downloaded faster.

When a file is first shared, it is uploaded by a single seed or user to the first downloader, who then forms a little file known as a "torrent." This file contains metadata about the files to be shared as well as the tracker, so a torrent will always be slow when it's first created; however, once that initial upload/download process is complete, the user or users who downloaded the file, also known as peers from the original seeds, also turn into seeds, and the more popular the file becomes, the more seeds are created, and the faster the speed will be for newcomers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13ivhh58ws3xahwjm8ac.png)
 
### **What are Leeaches**
Users who are downloading and uploading the content simultaneously.

### **What is a Tracker?**
A server that potentially tracks all the other users in the network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0n6l2o0wj2yhh1swwddx.png)
 
### **What is a Swarm?**
When you find a group of users downloading and sharing a common file, they’re known as a swarm.

### **Good Uses of Torrent!**
While torrent networks have become a haven for digital pirates and infringers, they may also be beneficial for synchronising massive files and sharing media that you possess the rights to. To save bandwidth, social media companies like Facebook and Twitter utilise a similar mechanism to upload huge files to their servers. As in the case of Starcraft, a torrent client can be embedded within a game to distribute software updates. Torrents are also used by some government entities to communicate big photographs and documents with the public that would otherwise overload their systems.

**Many a times we hear torrent is illegal.** Partial Ans is No, It only becomes illegal when some user uploads copyrighted content through a torrent client or a website.

HAPPY TORRENTING :)))