Difference between revisions of "Magnet URI scheme"

From Pulsed Media Wiki
m (Guides: Linux: Information)
m (How Magnet Links Work)
 
Line 34: Line 34:
 
2. The BitTorrent client reads the content hash (''btih'') from the link.
 
2. The BitTorrent client reads the content hash (''btih'') from the link.
 
3. The client searches for peers using:
 
3. The client searches for peers using:
   * [[Distributed Hash Table (DHT)]]
+
   * Distributed Hash Table (DHT)
   * [[Peer Exchange (PEX)]]
+
   * Peer Exchange (PEX)
 
   * Optional trackers included in the link
 
   * Optional trackers included in the link
 
4. Once peers are found, the client begins downloading the file directly from them.
 
4. Once peers are found, the client begins downloading the file directly from them.

Latest revision as of 17:48, 18 June 2025

Magnet URI Scheme

The Magnet URI scheme, commonly referred to as a magnet link, is a type of hyperlink used to identify and download files based on their content rather than their location. It is widely used in peer-to-peer (P2P) networks, especially in the BitTorrent protocol, to enable decentralized file sharing without needing a centralized tracker or a separate .torrent file.

Magnet links are content-addressable, meaning they rely on a unique hash of the file's content to locate it among peers in the network.

Format

A typical magnet URI looks like this:


 magnet:?xt=urn:btih:<hash>&dn=<filename>&tr=<tracker_url>


Where:

  • xt – Exact topic (the unique hash of the file, usually in SHA-1 for BitTorrent)
  • dn – Display name (optional, shows the file name)
  • tr – Tracker URL (optional, assists in peer discovery)
  • xl – Exact length (file size in bytes, optional)
  • xs – Exact source (URL to the file, optional)

Example

 magnet:?xt=urn:btih:5a3b3e5e38b1b9c54bb3e1f3f5b5e5d9c7123e5f&dn=Ubuntu+ISO&tr=udp://tracker.openbittorrent.com:80


This magnet link represents a torrent with a specific hash, suggests a display name "Ubuntu ISO," and provides a tracker to assist in finding peers.

How Magnet Links Work

1. A user clicks a magnet link in a torrent index site or application. 2. The BitTorrent client reads the content hash (btih) from the link. 3. The client searches for peers using:

  * Distributed Hash Table (DHT)
  * Peer Exchange (PEX)
  * Optional trackers included in the link

4. Once peers are found, the client begins downloading the file directly from them.

Advantages

  • No need for .torrent files – Reduces server load and dependency on external hosting
  • Decentralized – Works even without a central tracker
  • Permanent and portable – The hash uniquely identifies the content, not the location
  • Easy to share – Can be distributed via websites, email, QR codes, etc.

They are commonly used on public and private torrent index websites in place of traditional .torrent file downloads.

See Also