Unless you’ve been hiding under a rock for some time now, you'll have heard the word 'blockchain' being thrown around. It was a big buzzword in 2018, and people are still chatting about it now. But despite the fact we're frequently told it's going to be a game-changer, not many people seem to know what blockchain is.
This guide is here to help. In it, I’ll explain everything about blockchain – what it is, how it works, and why it's taking the world by storm – all in plain English.
Why do we need blockchain?
In essence, Blockchain is a decentralised database (or ledger) that records information in a way that it is permanent and public.
To explain how blockchain works, I'll use an example. Imagine you want to send some money to your friend, how would you do it? You would reach out to your bank and tell it to transfer money from your account to your friend’s.
When we tell the bank to do this, all it does is make an entry in a register. It would look something like the image above. Once the entry has been made in the register, you can call your friend and tell them the money is in their account.
Note: We are not talking about computers just to avoid complexity. If you prefer, think of this register as just another database.
What just happened? Did just one entry in a register transfer the money? Yes. All we need to move money around the world is to enter the information into a register.
However, the entry needs to be made in someone else’s register; and that’s the problem. What if your bank manager makes a mistake when writing down the transaction? What if the bank manager purposefully miswrites the transaction to favour your friend? What if the bank manager runs away with the register?
Smart people among us started asking an important question: how can we avoid third parties, like banks, and still maintain the register? The solution is blockchain.
How does blockchain work?
We now know that blockchain is just another way to maintain a register – nothing more than that. Imagine there are 10 individuals who want to stop using banks. On mutual agreement, they have details of each other’s accounts all the time – without knowing the other’s identity.
01. The empty folder
To start with, everyone has an empty folder. As we progress, each of these 10 individuals will add pages to their folder. This collection of pages will form the register that tracks the transactions.
02. Making a transfer
Everyone in the network sits with a blank page and a pen in their hands. Everyone is ready to write any transaction that occurs within the system.
Suppose person no 2 wants to send $10 to person no 9. To make the transaction, no 2 shouts and tells everyone, 'I want to transfer $10 to no 9. Everyone, please make a note.'
Everyone checks whether no 2 has enough balance to transfer $10 to no 9. If she does, everyone then makes a note of the transaction on their blank page.
03. Tracking transactions
Transactions keep happening within the network and everyone keeps writing them down until their page gets filled. When that happens, everyone has to put the page away in their folders, bring out a new page and start the whole process again. The magic of blockchain lies when the page has to be put away in the folder.
04. Starting a new page
The deal is that when the page goes in the folder, everyone’s version of the page must look same and it must not be modified ever in the future. To accomplish this, we will seal the contents of the page.
How to we seal a page?
We seal the page using something called a hash function. Think of hash function as a magic machine that takes some data from left and outputs some gibberish-looking data on the right.
The important thing about these machines is that they make it very difficult to reverse this process. In other words, given an output, the only way to figure out the input is to try every possible option until you hit on the right one.
So let's say I ask you the following question: What should I send from the left side of the machine such that I get an output that starts with three leading zeros (eg 000ab or 00098)? Because reversing the process is impossible, we’ll have to try every number in the universe until we get the output with the desired constraints – three leading zeros. This feature comes in handy when sealing the page.
Now imagine I gave you two boxes. The first box contains the number 20893. I ask you: Can you figure out a number that when added to the number in the first box and fed into the machine will give us a code that starts with three leading zeros?
After trying every number, we might stumble upon the number – say 21191 – we were looking for.
In this case, the number 21191 becomes the seal for the number 20893. If we write 20893 on a page and put a seal labeled 21191 on the page, the page is sealed. If anyone ever has to verify the authenticity of the page, they could simply add the two numbers and feed the answer to the machine. If the output has three leading zeros, the contents are still authentic.
To seal a page containing a list of transactions, we need to figure out a number that when appended to the list of transactions and fed to the machine gives a code that starts with three leading zeros on the right.
Now that we know about sealing the page, we will go back to the time when we had finished writing the last transaction on the page, and we ran out of space to write more.
How do we establish the sealing number?
As soon as everyone runs out of room on the page to write further transactions, they calculate the sealing number for the page so it can be tucked away in the folder. Everyone in the network does the calculation. The first one in the network to figure out the sealing number announces it to everyone else.
Immediately on hearing the sealing number, everyone checks if it yields the required output or not. If it does, everyone seals their page with this number and puts it away in their folder.
But what if for someone, say #7, the sealing number that's announced doesn’t yield the required output? In that case, he would have to discard his version of the page, copy the page again from someone else, and then put it away in his folder. Now, everyone is using the same version of the page.
You might ask me now: Why does everyone spend time doing the calculation when they know that someone else will calculate and announce it to them? Why not just wait for the announcement?
Great question. The person who does the calculation first is rewarded with some free cryptocurrency – say bitcoins (opens in new tab). That’s how bitcoin came into existence.
What happens now?
Once everyone has tucked away the page in their folders, they bring out a new blank page and repeat the whole process all over again, and so on, forever. Think of a single page as a block of transactions and the folder as the chain of pages ('blocks'), therefore, turning it into a blockchain.
And that, my friends, is how blockchain works. You can check out a more in-depth look at what blockchain is here (opens in new tab).
Our sister site, TechRadar, also has a guide on How to mine Bitcoins (opens in new tab) and The best cryptocurrency mining software (opens in new tab), which you might also enjoy.