What do we curious Hackaday scribes do when we want to learn about something? First port of call: search the web.
When that something is blockchain technology and we’re looking for an explanation that expands our cursory overview into a more fundamental understanding of the basic principles, there is a problem. It seems that to most people blockchains equate to one thing: cryptocurrencies, and since cryptocurrencies mean MONEY, they then descend into a cultish frenzy surrounded by a little cloud of flying dollar signs. Finding [Daniel van Flymen]’s explanation of the fundamentals of a blockchain in terms of the creation of a simple example chain using Python was thus a breath of fresh air, and provided the required education. Even if he does start the piece by assuming that the reader is yet another cryptocurrency wonk.
We start by creating a simple class to hold all the Python functions, then we are shown a single block. In his example it’s a JSON object, and it contains the payload in the form of a transaction record along with the required proof-of-work and hash. We’re then taken through a very simple proof-of-work algorithm, before being shown how the whole can be implemented as very simple endpoints.
You are not going to launch a cryptocurrency using this code, and indeed that wasn’t our purpose in seeking it out. But if you are curious about the mechanics of a blockchain and are equally tired of evangelists of The Blockchain who claim it will cure all ills but can’t explain it in layman’s terms, then this relatively simple example is for you.
The wrong way to build a blockchain image: Jenny List. #FarmLife.