Blockchain: In layman’s terms..

Image credits : Welivesecurity.com

Bitcoin is at its all-time high. Last week, one of my friends told me that he had started dabbling in the crypto market, and right now the returns are decent. I do not understand the logic of bitcoin trading and that’s why I keep my hard-earned money away from it.

However, this got me interested in the underlying technology that enables bitcoin’s existence. Blockchain by textbook definition is a shared immutable ledger that facilitates the recording and tracking of transactions. But what does this exactly mean. I’m no expert on blockchain and this article is simply to share the understanding that I got while looking to understand the concept myself. So, if anybody wants to correct or add anything, more than welcome. Let’s get started.

First of all, bitcoin and block-chain are two different things. You can equate the block-chain to an operating system (Windows, Android) and bitcoin to the apps running on these OS. Just as OS gives a platform to software to run, block-chain is the underlying technology while bitcoin is a digital or cryptocurrency. Here, I have used the bitcoin blockchain as an example to explain the structure. Most of the blockchains will share these characteristics.

All the participant systems of blockchain are known as nodes and a copy of the blockchain is maintained on each of them. Further, blockchain can be split into block+chain. A block is simply an accumulation of transactions that is definite in size. Bitcoin blockchain allows each block to be 1 MB in size post which, a new block is created.

For example, if I buy something online for Rs 100 from Amazon, the transaction will say (Amazon +100, Yash -100). Along with this, the transaction will have the public key(similar to UPI address) of both Yash & Amazon to identify between whom the transaction has taken place. For executing the aforementioned transaction, the blockchain will require my private key (similar to a UPI PIN). Many transactions like this are accumulated together in one place which is called a block.

Now, for the block to be added to the blockchain, it needs to get a unique digital signature or a hash. This is accomplished through a hashing process that passes every block’s transaction info through a cryptographic hash function (let’s call it hash creator) and generates a random unique hash for it. And who performs this hashing process? This is where we use the fancy term ‘miners’ (we will get to what miners do in a while).

Every block, along with all the transactions assigned to it, will have the hash of chronologically previous block also. And this is what essentially creates a chain (the length of the bitcoin blockchain as of Nov 2020 is 6,56,197 blocks). Every block, after assignment of its unique hash, will be added to the end of the blockchain, which makes blockchain a linear transaction storage system. All that is discussed till this point, can be summarized in the figure below.

Now, what do miners do? Simply put, they try to guess the random hash for every block. Each acceptable hash must have a certain prerequisite. Let’s assume that the blockchain requires the hash to begin with a certain number of consecutive zeroes, say 10 zeroes. As mentioned earlier, for every unique random data, a random hash will be generated. If we so much as change ‘Bread’ to ‘bread’ in the above example, it will generate a completely different hash for block 1, which in turn will generate a new hash for block 2 and will continue till the end of the chain.

When a specific set of data passes the hash creator, the resultant random hash will always remain the same. So, if block 1’s hash contains only 2 consecutive zeroes in the beginning (as against the required 10 zeroes for example), the result will always remain the same no matter how many times the hashing is done. Then how do miners get to the required 10 zeroes? They simply add a random number (and always a number only) to the overall info of the block and generate the hash again. This random number is called nonce and miners keep changing it until they find the hash which adheres to blockchain requirements.

This is essentially a trial and error method commonly known as Proof-of-Work and requires huge computational prowess simply owing to the number of times a miner might have to do this to hit the jackpot hash. But why do it at all? Because for guessing the correct hash, miners get rewarded in bitcoins.

Once the hash is created by a miner, it is then broadcast to other miners on the network for verification. Any node can verify the same. In the figure above, assume 11 is the nonce that gives us the hash that fulfills all the requisite criteria. The winning miner node will broadcast (Amazon+100, Yash-100–11) to all the other nodes who can verify it by checking that if they input the given data into the hash creator, will it generate the hash claimed to fulfill the requisite criteria by winning miner node (in reality, it is a long checklist of which this is only a part). This will also prove that the winner has in fact worked to get to that result (Proof of work). Once the member node can verify the transaction independently, it will add the same to its existing version of blockchain. And once the block is added to blockchain, it can never be changed. Only a new block with altered data can be added after verification.

Do note that proof of work is one of the consensus models. Difference blockchains can use different methods for establishing consensus among their participant nodes.

Whenever we hear anything related to blockchain, security is one of its major selling points. The verification mechanism mentioned above is what makes it so secure. Blockchain works on a consensus model. To put it simply, the final acceptable version of the blockchain will be the one accepted by a majority of nodes. If a miner wants to change any transaction and add it to the blockchain, at least 51% of computational power on the blockchain network must approve of the same and for that, the miner must control 51% of it. So, the more the number of nodes in a blockchain, the more difficult it becomes to manipulate it.

Hope this helped in demystifying what blockchain is and how it works to some extent. If you are interested in knowing more about blockchain and related stuff, below are some useful links. CHEERS!

Chartered Accountant with a love of swimming, reading and writing. I'm a foodie, a cook and anime lover.