/ 10 Notes / Magnet Links.md
Magnet Links.md
 1  Magnet links has been introduced in [[BEP9 - Extension for Peers to Send Metadata Files]]. Here is a short summary with examples.
 2  
 3  Magnet link format:
 4  
 5  ```
 6  v1: magnet:?xt=urn:btih:<info-hash>&dn=<name>&tr=<tracker-url>&x.pe=<peer-address>
 7  v2: magnet:?xt=urn:btmh:<tagged-info-hash>&dn=<name>&tr=<tracker-url>&x.pe=<peer-address>
 8  ```
 9  
10  BEP9 provides detailed description of all the fields. Here it is important to emphasize that only `xt` is mandatory. In particular for our purpose, in trackerless torrents, we may see in practice the magnet links having only the `xt` attribute. Other attributes, especially `x.pe` (peer address), may be used as well, but our discovery should not relay on any other attributes than `xt`.
11  
12  Tow examples of such a simplest magnet-links:
13  
14  **Version 1**
15  
16  ```
17  magnet:?xt=urn:btih:1902d602db8c350f4f6d809ed01eff32f030da95
18  ```
19  
20  **Version 2**
21  
22  ```
23  magnet:?xt=urn:btmh:122003ee5d27d20f46c2395fb00e407a85f87c885e2e072d01f4e4bc516474203fe1
24  ```
25  
26  **Hybrid**
27  
28  ```
29  magnet:?xt=urn:btmh:122003ee5d27d20f46c2395fb00e407a85f87c885e2e072d01f4e4bc516474203fe1&xt=urn:btih:1902d602db8c350f4f6d809ed01eff32f030da95
30  ```
31  
32  `122003ee5d27d20f46c2395fb00e407a85f87c885e2e072d01f4e4bc516474203fe1` is a SHA-256 multihash:
33  
34  ```
35  sha2-256/03ee5d27d20f46c2395fb00e407a85f87c885e2e072d01f4e4bc516474203fe1
36  ```