Wha D Block – Run d Block (How to build a Blockchain)
Author: Gerard Ferreira
By now you should have a general understanding of blockchain (an open, decentralized ledger of data) and why many are becoming blockchain-believers.
But perhaps your inner nerd is curious about just how 🤔 is a blockchain is created.
Because of their association, we’ll use Bitcoin in this example, but remember blockchain can be used for much more than crypto, such as asset management.
With Bitcoin, the blockchain is used to record and manage transactions. Every transaction is contained in a ‘block’ and once the block reaches its storage capacity, it’s given a unique identifying code called a ‘hash’, and added to the chain. It’s a kind of “get in yuh section (and stay there)” vibe…
For this to happen, computers (called nodes) on the network verify the transaction, i.e., they ensure that the seller has enough currency for the transaction, and that there is neither double-spending nor fraud occurring. Once verification is complete, the hash is created by solving a complex mathematical puzzle.
The process of creating the hash is called ‘mining’⛏️, with the nodes that engage in mining called ‘miners’. Mining requires a great amount of computational power and energy, so miners are rewarded with Bitcoin.
Once the hash is created, other nodes on the network double-check the legitimacy of the block’s info and come to a consensus on which the miner receives Bitcoin for that block. There are numerous miners working on the same transactions but only one can be rewarded for a single block.
There are a few ways of achieving consensus, with the most common being ‘Proof of Work’ (PoW) and ‘Proof of Stake’ (PoS).
Bitcoin and Ethereum use PoW.
Simply speaking, PoW miners race against each other to solve the puzzle, with the ‘winner’ getting their block added (and thus the coin).
In PoS, a single node is selected at random to solve the puzzle by choosing a bitcoin from the nodes’ collective coin cache. As PoS works on probability, nodes with more coins have a greater chance of being chosen.
Once consensus is reached, a new block is added and the chain grows.
Lather, rinse, repeat. 🛁