I built Chorrent, a Rust library and CLI for sending files and folders from one device to another with a short code.

The idea originally came from n0's YouTube video, peer-2-peer, but it works, where they say they'd love to see someone write a BitTorrent implementation on top of iroh.

Chorrent isn't BitTorrent-compatible, but that line stuck with me and around the same time I found sendme (which I've since contributed to a little), and I wanted that kind of simple, code-based transfer in my p2p messenger app.

With the help of Chorrent I was able to increase the media transfer limit in the app from 16 MB to 13 GB (tested).

Then the idea of group chats came up (not in the app yet), which is where Chorrent differs from sendme. When ten people want the same file, sending it ten times from one phone doesn't scale. So I built a swarm on top of the one-to-one transfer: downloaders pull pieces from everyone who has the file and pass them on, BitTorrent-style.

Built on iroh 1.0.3:

  1. QUIC with hole punching and relay fallback. Downloads use one stream per piece request, with more requests in flight the higher the RTT
  2. iroh-gossip to find the other seeders of a share
  3. Every 64 KiB piece verified with BLAKE3 (bao-tree), so pieces can come from anyone in the swarm
  4. An embedded mode that runs on an app's existing endpoint (same identity, same relay), plus optional Mainline DHT address lookup

It's open source (Apache-2.0), and I'd love help making it even better with your help. CONTRIBUTING.md explains how to get going. Questions about the code or how it uses iroh are welcome here or by DM, and so is any feedback.
Thank You.

Try it: cargo install chorrent-cli, then chorrent seed <file> on one machine and chorrent get <code> on another.
Repo: GitHub - mrsarthi/Chorrent: Share files and folders directly between devices with a short code. Everyone who downloads helps share it. · GitHub · Docs: chorrent - Rust

1 post - 1 participant

Read full topic