# Torrent crates

**URL:** <https://internals.rust-lang.org/t/torrent-crates/8574>\
**Category:** Uncategorized\
**Created:** [October 16, 2018, 1:16am UTC](https://internals.rust-lang.org/t/torrent-crates/8574 "2018-10-16T01:16:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [October 16, 2018, 1:16am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/1 "2018-10-16T01:16:02Z")

</div>

Crates should be available over bittorrent. Cargo should have an optional daemon that seeds them. Crates with torrent dependencies should be publishable on [crates.io](http://crates.io), which should also make an effort to seed them. Such crates should only be visible on [crates.io](http://crates.io) after [crates.io](http://crates.io) has retrieved the relevant torrents, thus there’ll be a small delay in publishing, but that’s okay since these crates never go down - even when [crates.io](http://crates.io) is down.

---

<div class="post-metadata">

**Author:** ![kornel](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kornel/32/2711_2.png) [@kornel](https://internals.rust-lang.org/u/kornel)\
**Post date:** [October 16, 2018, 1:52am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/2 "2018-10-16T01:52:56Z")

</div>

Cargo supports [custom registries](https://boats.gitlab.io/blog/post/2017-10-28-alternative-registries/). You could implement a torrent-backed registry on localhost and configure that in Cargo.

---

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [October 16, 2018, 2:01am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/3 "2018-10-16T02:01:38Z")

</div>

Torrents are immutable and censorship-resistant, making them a suitable alternative to conventional registries.

Your suggestion doesn’t solve the problem of publishing torrent-dependent crates on [crates.io](http://crates.io).

---

<div class="post-metadata">

**Author:** ![earthengine](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/earthengine/32/2577_2.png) [@earthengine](https://internals.rust-lang.org/u/earthengine)\
**Post date:** [October 16, 2018, 2:04am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/4 "2018-10-16T02:04:54Z")

</div>

I am with this idea.

---

<div class="post-metadata">

**Author:** ![kornel](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kornel/32/2711_2.png) [@kornel](https://internals.rust-lang.org/u/kornel)\
**Post date:** [October 16, 2018, 2:14am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/5 "2018-10-16T02:14:57Z")

</div>

Indeed, but [crates.io](http://crates.io) is itself a centralized service and the implementation doesn’t guarantee immutability (it doesn’t allow it as a matter of policy, but technically the index could be mutated), so if you wanted these properties, you’d have to publish elsewhere anyway.

---

<div class="post-metadata">

**Author:** ![kornel](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kornel/32/2711_2.png) [@kornel](https://internals.rust-lang.org/u/kornel)\
**Post date:** [October 16, 2018, 2:16am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/6 "2018-10-16T02:16:33Z")

</div>

Another integration method could be via git torrent transport. Cargo (but not [crates.io](http://crates.io)) supports git dependencies, and for git deps you can also add `rev=hash`, so a Cargo git dep using git-torrent-transport and a hash should be pretty immutable.

---

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [October 16, 2018, 2:25am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/7 "2018-10-16T02:25:25Z")

</div>

gittorrent is bad, any project using gittorrent should be avoided at all costs. any “decentralized” project that relies on a distributed centralized system (bitcoin) is inherently bad.

(unless you like climate catastrophe, ofc.)

(yes, distributed systems _can_ be centralized. e.g. cloudflare is distributed, but I wouldn’t call it decentralized.)

(Just because anyone can run a node, doesn’t mean it’s decentralized. If you, running a node, don’t have any power over it, then it’s not decentralized, it’s just distributed. Since bitcoin is based on an algorithm, and changing that algorithm creates incompatible implementations, then bitcoin is inherently centralized - the network is owned by the algorithm, rather than being owned by a person.)

---

<div class="post-metadata">

**Author:** ![Nemo157](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nemo157/32/11585_2.png) [@Nemo157](https://internals.rust-lang.org/u/Nemo157)\
**Post date:** [October 16, 2018, 11:59am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/8 "2018-10-16T11:59:59Z")

</div>

I was quite keen on trying to get crate distribution via IPFS working, until I started implementing IPFS and became disenchanted with a lot of the technical choices in it.

I still like the idea of having crates distributed via a global content addressable store, but I don’t think it would be good to build this directly on raw torrents. You probably want something that has a mutable naming scheme on top like IPNS to support short references for the `Cargo.toml`, then the hash can be entered into the `Cargo.lock` so that even if the name is changed you still can find the correct package. You could build this on top of torrents yourself, but it would be good to have it part of an existing system.

---

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [October 16, 2018, 12:04pm UTC](https://internals.rust-lang.org/t/torrent-crates/8574/9 "2018-10-16T12:04:46Z")

</div>

Nope, I have no plans to support mutable content.

You might be interested in [dat](https://datproject.org/) tho.

---

<div class="post-metadata">

**Author:** ![Nemo157](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nemo157/32/11585_2.png) [@Nemo157](https://internals.rust-lang.org/u/Nemo157)\
**Post date:** [October 16, 2018, 12:08pm UTC](https://internals.rust-lang.org/t/torrent-crates/8574/10 "2018-10-16T12:08:20Z")

</div>

> [@Soni](#):
>
> Nope, I have no plans to support mutable content.

Do you want to manually check for new versions of crates continuously? To be able to automate updating you need some reference to a mutable list of versions. It also makes the user interface much nicer to be able to specify a nice name instead of a hash in the `Cargo.toml`

```toml
serde_json = { ipns = "serde.rs/json" }

```

---

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [October 16, 2018, 12:12pm UTC](https://internals.rust-lang.org/t/torrent-crates/8574/11 "2018-10-16T12:12:07Z")

</div>

well, dat has .well-known support, so you could just use a domain name.

whatever = { foo = “dat://example.org” }

I still like torrents. they guarantee immutability, and thus reproducible builds.

---

<div class="post-metadata">

**Author:** ![Nemo157](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nemo157/32/11585_2.png) [@Nemo157](https://internals.rust-lang.org/u/Nemo157)\
**Post date:** [October 16, 2018, 12:28pm UTC](https://internals.rust-lang.org/t/torrent-crates/8574/12 "2018-10-16T12:28:32Z")

</div>

Yep, IPNS is built off well-known DNS TXT records as the basis for lookup as well. I think pretty much all global naming schemes will end up being rooted in DNS since it’s so widely available.

By resolving the mutable references into actual content-addressed-hashes for the `Cargo.lock` you maintain reproducible builds (with guaranteed immutability), while having a way to automatically find out about new versions of crates and supporting a nicer UI. Torrents would work well for the content-addressed-hash part, it’s just the user-friendly mutable addressing on top that they don’t target.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:30am UTC](https://internals.rust-lang.org/t/torrent-crates/8574/13 "2019-03-25T08:30:59Z")

</div>

Closed on March 25, 2019, 8:30am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
