I started 2022 with a mini batch at the Recurse Center. I did a full batch in Fall 2020, and hanging out with people working on their side projects fu

Rewriting my toy blockchain in Rust

submited by
Style Pass
2022-01-14 16:30:06

I started 2022 with a mini batch at the Recurse Center. I did a full batch in Fall 2020, and hanging out with people working on their side projects full time seems like a fun way to kick off the year.

My plan was to port my toy blockchain from Python to Rust (repo here, write-up here). The initial project had multiple iterations, starting with proof-of-work and later Merkle trees and elliptic curve cryptography - a suitable candidate for a 1-week rewrite.

As with a lot of RC projects (for me anyway), things rarely play out as planned. I had moments of confusion with the Rust compiler, moved past that to contemplate working on speedups, but ended up compiling to WebAssembly to enable mining in the browser.

What I thought made for a nice ending was being able to connect the mini batch project with what I had previously worked on at RC.

For our purposes, a blockchain is a distributed database where records are divided into 'blocks' and the blocks form a 'chain'.

Leave a Comment