Photo by NASA on Unsplash

Building a Blockchain: Introduction

One of my personal project involves writing a blockchain, in Java, using TDD (Test-Driven Development). The project is blockchainj. To me, a blockchain is a “case from the book” for TDD: I can implement the different pieces incrementally, guided by use cases, and enforcing simplicity. I’m really enjoying writing code for this project.

Unless you were trapped in a closet during the last ten years, you must know what is a blockchain: simply, a chain of blocks, managed by a distributed network of nodes. Bitcoin is the most known implementation, but there are many others, like Ethereum, EOS, IOTA, Hyperledger, Quorum, and dozens more.

Some use cases I’m implementing in my project:

  • Node sending message to other nodes

To support smart contracts, I planned to have more than one virtual machine, but the first one to be used is an Ethereum-like one. In this way, I could use the already existing Ethereum smart contracts, mainly written in Solidity programming languages (see my Solidity samples repo).

In order to leverage Ethereum ecosystem, I started to support JSON RPC interface so a node could be invoked from external applications, like dapps (decentralized applications) and wallets.

Another use cases to consider/implement:

  • Long synchronization of a node with the rest of the network

I hope this post be the first one in a series about this project. I want discuss the design decisions, incremental implementation and emergent design.

TDD rocks!

Angel “Java” Lopez