Skip to content

Instantly share code, notes, and snippets.

Last active October 15, 2021 09:29
Show Gist options
  • Save elichai/673b031fb235655cd254397eb8d04233 to your computer and use it in GitHub Desktop.
Save elichai/673b031fb235655cd254397eb8d04233 to your computer and use it in GitHub Desktop.
Rust Bitcoin core

Q: Pathway wise is this even possible to have a parallel Rust thing going at the same time?
A: Yes, Rust is a compiled non-gc languange just like C++, Rust can call easily call into C functions and easily expose a C API (Rust can also do this with C++ but less "easily").

Q: At the same time there are a lot of big companies making that same bet... I wish I had more examples than that but I don’t off the top of my head

  1. Google is actively using Rust in multiple projects: Fuchsia[0] CrosVM(part of Chromium OS)[1], and probably more[2][3]
  2. Microsoft, it was already said but microsoft is using Rust in Windows[4], wasm related tools[5], and more[6] they also have people whose all job is making rust+windows experience better[7]
  3. Facebook is both experimenting with rust[8][9] and using it in production[10]
  4. Dropbox main sync engine is written in Rust[11].
  5. Amazon is using rust in Lambda, EC2, S3 and even virtualization[12].
  6. Here's Meeting notes from a meeting between rust core devs and multiple big companies about integrating rust.

Q: You’ve got rust-bitcoin ... which still has a big warning at the top of the README saying “Don’t use in this production for consensus critical applications.”
A: The comment in the readme says This library must not be used for consensus code not Don’t use in this production, rust-bitcoin is actively used in production by many users (Liquid, electrs(electrum server), rust-lightning and more)

Q: I have never seen a rust-bitcoin node be listed on an
A: That's because rust-bitcoin isn't a full node implementation, it doesn't have any validation code nor a p2p implementation, rust-bitcoin is a library that provides all the needed primitives and operations you need to interact with bitcoin (Encoding/Decoding transactions,blocks, etc. Create and sign transactions, manipulate scripts and more)

Q: There is one argument to be made that it is not stable yet
A: That requires defining "stable" is ABI stability "stable"? is compiler backwards compatibility stable? is no new features stable?.

Q: The only way you get Linux in Rust to rewrite everything... I thought there were people introducing some Rust things into the Linux kernel.
A: There's active positive discussion around linux and rust[13], and people are working on the right infra to make it happen[14][15]

Q: I can’t think of an open source project that has switched implementation languages and survived. I can’t think of many that have tried to switch implementation languages.
A: No one is talking about really switching the whole implementations, but gradually adding a new language,similar what the tor project did, which is also a very security critical OSS project and is adding more and more rust where today rust is the second biggest language in the tor core code[16].

Q: What about making a fresh one starting from scratch in Rust? There is rust-bitcoin.
A: As said before most rust-bitcoin maintainers and contributors belive that a separate node implementation isn't a great idea, so as I mentioned before it's just a library.

Copy link

Thanks for this Elichai, I will add to the agenda for the next Sydney Socratic Seminar so we at least clarify some of these.

Would it not make sense for people to work on using rust-bitcoin as a full node implementation to find out what problems there are with using Rust in a full node implementation? I understand why people don't believe a separate node implementation is a great idea but some people also oppose Rust being introduced into Core.

Once introduced (assuming it is introduced) Rust will be used more and more in Core. Having a separate node implementation in Rust exposed to the network would surely be a good stepping stone to convincing people that the time is right to introduce Rust to Core.

I don't support sneaking Rust in by the back door. I think it is a huge long term strategic decision for the project and before it is introduced (assuming it is introduced) it needs to meet a number of high bars set by those with concerns. One of those high bars could be having a full node implementation in Rust using rust-bitcoin in production.

Copy link

elichai commented Jun 6, 2020

I find "having a full node implementation in Rust using rust-bitcoin in production" and "I understand why people don't believe a separate node implementation is a great idea" somewhat in contradiction, if someone believes that a full validating node in an alternative language is a bad idea than writing one for production is probably a bad idea.

One compromise can be that you write everything in Rust except validation code, which gives us:, is writing a full node using rust-secp256k1 and rust-bitcoinconsensus a good or bad idea? idk.

Copy link

I understand why they don't like the idea. Though I guess I disagree. I would rather have a small number of rust-bitcoin full nodes on the network if it means kinks and concerns get worked out before Rust is introduced to Core. We already have a small number of btcd nodes and bcoin on the network to demonstrate what a full node in Go and Javscript looks like and to test the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment