The principles of the BitTorrent protocol and the MagNet protocol.
The BitTorrent protocol is a peer-to-peer file sharing protocol that allows users to increase download speeds by splitting files into smaller pieces and downloading them from multiple sources simultaneously.
- File sharing: A user, typically the creator of the file, breaks the file into smaller pieces and creates a metadata file called a seed file. The seed file includes information such as the file’s hash value, file name, and file size.
- Users upload the torrent file to one or more tracker servers. These servers maintain a list of users who are sharing the file and facilitate communication between them.
- Peers discover: Other users obtain the seed file through the tracker server and join the list of shared users for that file. Users can inform each other of their presence.
- Peer exchange: Sharing users exchange their file block information with each other through the Peer Exchange Protocol. Each user keeps a record of which blocks they have and requests missing blocks from other users.
- Chunk downloading: Users receive file chunks from other users and combine them to create the complete file. Users can download chunks from multiple sources simultaneously to speed up the downloading process.
The MagNet protocol is a metadata exchange protocol based on the BitTorrent protocol, working as follows:
- Metadata creation: A user generates metadata file called a Magnet link. This link includes information such as file hash value, file name, file size, similar to a BitTorrent seed file.
- Metadata propagation: Users share Magnet links with others, allowing them to access the metadata of the file.
- File download: Users use the acquired metadata to download file blocks from other users via the BitTorrent protocol and assemble these blocks into a complete file.
The MagNet protocol eliminates the need for a Tracker server and instead facilitates metadata exchange directly through Magnet links, making file sharing more decentralized compared to the BitTorrent protocol.