In this post we follow up from my previous one. Check that out first. Until now, we have a node which mines blocks, and allows us to send data to be included in said blocks. It’s all nice and well, but something is missing to make it useful. Since blocks are guaranteed by the difficulty of producing a valid chain of the same length as the one we already have, our chain is as secure as the total computation power we’ve used to produce it. That is not very secure if the entire chain is generated on a single computer. Many computers could generate a longer chain in a short time. We need to start mining on multiple computers.
This is follow-up post to how to build your own blockchain with crystal. I was following along this tutorial on how to build a basic blockchain in crystal to familiarize myself with the syntax, and while it was a very helpful blockpost - I wasn’t completely happy with where it ended. True, the concept of mining had been explained, somewhat. The block integrity was there. But then I went on with the guide, I deployed it to AWS ECS / Fargate, and the limitations started to annoy me even more. We are scaling with individual blockchains - we have a centralized blockchain - a node has a chain, and is the authority on blocks it creates. difficulty is at it’s discretion.