Global content discovery for iroh, using the BitTorrent Mainline DHT.
You publish a blob, and anyone who knows its BLAKE3 hash can find you and
download it, without a tracker, a server you run, or anyone's permission. On
top of that, https://<hash>.blake3.net links let you browse content-addressed
websites, and https://<key>.pkarr.net names let you point to them.
The background is in the blog post Iroh global content discovery.
Mainline is the most successful permissionless content discovery system out
there, so we use it as is. A provider announces SHA-1(blake3_hash) on
Mainline. A reader asks Mainline for that infohash and gets back a list of
host:port pairs.
But iroh dials endpoints by EndpointId, not by address, and most of those
addresses are behind a NAT anyway. So we need one tiny extra piece: an
address index that maps a verified host:port to a few bytes. Providers
store a signed record with their EndpointId there, over the same UDP socket
they use for Mainline. Readers translate the host:port pairs into candidate
endpoints, dial them with iroh's normal hole punching, and verify every byte
against the BLAKE3 hash. A wrong answer anywhere along the way can waste time,
but it can't make you accept the wrong content.
The address index doesn't depend on iroh at all. In the long run we would love for Mainline to do this job itself.
- Install the gateway. There are installers for macOS, Windows and Linux on the releases page, or build it from source.
- Install the iroh link browser extension from the Chrome Web Store for Chrome or Brave. The Firefox version is awaiting review; until then you can load it as a temporary add-on.
The extension rewrites blake3.net and pkarr.net links to the gateway on
localhost:45475, which finds the content and streams it to the browser. Try
some static content, or a pkarr name currently
pointing to it.
To publish your own content and names, use iroh-share, a daemon that keeps your content and names announced. Run it on a box that's on all the time.
iroh-mainline-endpoint-discovery: publish and resolve iroh endpoints through Mainline and the address index. Start here if you want to use this from your own iroh application.udp-addr-indexandudp-addr-index-proto: the address index server and its wire protocol.iroh-link-gateway: the local HTTP gateway.iroh-link-extension: the browser extension.
To see the whole thing work in one process, discovery and all:
cargo run -p iroh-mainline-endpoint-discovery --example blobsThis is experimental. It works, but it's far from perfect: Mainline traffic is unencrypted and easy to block, Pkarr names use Ed25519, which is not post-quantum secure, and most importantly, there is no privacy. If you share content, anybody can look up your IP address.
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.