Crafting a Blockchain in Go and Rust: A Comparative Journey — Introduction and Overview [Part 0]

Crafting a Blockchain in Go and Rust: A Comparative Journey — Introduction and Overview [Part 0]

What I cannot create, I do not understand. — Richard Feynman

No you did not misread the title and also no the title is not a clickbait title to get you to click. This is just one of those ideas that sound awesome when you have them and after a while the become even more awesome!

Part 1 — Crafting a Blockchain in Go and Rust: A Comparative Journey — Private keys, Public Keys and Signatures ->

What I cannot create, I do not understand. — Richard Feynman

Anyway, yes I decided to write from scratch a Blockchain in both Go and Rust.

Introduction

In order to do this I need to emphasise the importance of understanding difference between the two languages and how this comparative journey can highlight their strengths and weaknesses.

The goal is to implement the same blockchain in both languages, but taking advantage of what each language has to offer so the implementation, libraries used may differ but the goal is to be able to offer the same features and user experience in both.

Motivation

Programmers love to compare programming languages. “This one is faster”, “That one is easier to understand”, “Ohh but this other one is typed and you gotta have types”. Well, I actually believe that every programming language has a purpose and there is no silver bullet. You just gotta use the best tool for the job.

With that in mind, have you ever watched Ocean’s Twelve? The one where the thieve challenges Ocean’s Crew to steal the same object, because it would be the only way to definitively decide who is the better thieve.

Well, this is where I got the idea from. I love Go, but I also love Rust and I wanted to build a blockchain from scratch to better understand the in’s and out’s of a blockchain at a deeper level, like I did before with my SQLRite project where I build a database from scratch in Rust.

These types of projects, specially a blockchain, are great because they touch a wide range of topics from proper understanding of data structures, cryptography, networking, distributed computing, consensus algorithms, EVM’s and the list goes on.

How addresses are actually generated and secured?

What is the best consensus algorithm?

Any networking limitations?

How is the data stored and is there a better way?

What do I need to make it EVM compatible?

Can I actually get to a point where I can deploy a EVM Compatible smart contract on my own blockchain?

Well, these are some of the questions I aim to answer along the way, and there are a lot more.

What to expect

I wrote down a list of features and also somewhat of a Roadmap, based on my initial research and expectation but of course that is subject to change since I am diving into unexplored waters here (for me at least). With that said, I am open to any suggestions and even contributions of whoever want to lend a hand, as long as some knowledge is also shared in the process. It’s all welcome!

Here it is!

Features (WIP)

  • Proof of Work (PoW) Consensus Mechanism (Subject to Change)

  • Peer-to-Peer (P2P) Networking

  • Storage and Persistence

  • Transaction and Block Validation

  • Smart Contract Support via EVM Compatibility

  • JSON-RPC API

  • Comprehensive Unit Tests and Benchmarks

Roadmap (WIP)

Not necessary prioritized in the order of development

[ ] Add CLI support for ease of interaction
[ ] Implement the basic blockchain data structure
[ ] Proof of Work (PoW) consensus mechanism
[ ] Peer-to-Peer (P2P) networking implementation (transport layer)
[ ] Basic transaction and block validation
[ ] Storage and persistence for blockchain data
[ ] EVM integration for smart contract support
[ ] JSON-RPC API implementation
[ ] Advanced transaction handling and validation
[ ] Enhanced security measures and best practices
[ ] Performance benchmarking and optimization
[ ] Comprehensive documentation and examples
[ ] Implement wallet functionalities
[ ] Improve EVM compatibility and support
[ ] Add more consensus mechanisms (e.g., PoS)
[ ] Implement light client support
[ ] Improve network protocol for better scalability
[ ] Develop a robust test suite for security and performance
[ ] Integration with Ethereum development tools
[ ] Develop a block explorer
[ ] Implement governance mechanisms
[ ] Cross-chain interoperability solutions
[ ] Improve documentation and developer guides

Sorry if some of the Roadmap does not make much sense now, but creating a blockchain from scratch is no small task so there is a lot in my mind right now and I am trying to keep things fairly organised, but well, not everything will be perfect at first. The goal is to get the ball rolling and keep re-iterating again and again and adjust as we go.

At the time of publishing this, there is not much to see yet other than a very nice README, since I’ve been focusing mostly on research, but if you want to follow the project don’t forget to CLAP this post and also STAR the projects on Github.

I wonder which project will get more stars…

View on Github (Pull Requests are Welcome) — Rust Version

View on Github (Pull Requests are Welcome) — Go Version

Cheers!