- Blockchain is a method to maintain a transaction register among ourselves instead of depending on someone else to do it for us
- If someone has to modify a historical page of transactions, she/he would also have to change the contents and the sealing number of all the pages after that, to keep the chain consistent
- If the majority of the individuals in the network decide to turn dishonest and cheat the rest of the network, the protocol will fail its purpose
Unless you’ve been hiding under a rock, I am sure you’ve heard of Bitcoins and blockchain. After all, they are trending on social and are the media’s favourite topics these days . Even those who’ve never mined a cryptocurrency or understand how it works are talking about it. I have more non-technical friends than technical ones. They have been bugging me for weeks to explain the new buzzwords to them. I guess there are thousands more out there who want the same. So, it’s time to write something towards which everyone can point other lost souls to. That’s the purpose of this post, written in plain English that any regular internet user can understand.
Blockchain: Why do we even need something this complex?
“For every complex problem there is an answer that is clear, simple, and wrong” — H L Mencken
Unlike every other post on the internet, instead of first defining the blockchain, we’ll understand the problem that it solves.
Imagine your best friend is Joe. He is travelling overseas, and on the fifth day of his vacation, he calls you and says, “Dude, I need some money. I have run out of it.”
You reply, “Sending some right away,” and hang up.
You then call the account manager at your bank and tell him, “Please transfer $1000 from my account to Joe’s.”
Your account manager replies, “Yes, sir.”
He opens the register (online as the case may be) and checks your account balance to see if you have enough balance to transfer $1000 to Joe. You have plenty. He makes an entry in the register that goes like this:
Note: We’re not talking about computers only to keep things simple.
You call Joe and tell him, “I’ve transferred the money. Next time you go to the bank, you can withdraw the $1000.”
What just happened? Both you and Joe trusted the bank to manage your money. No real movement of physical bills was involved in the transfer. All that was needed was an entry in the register. Or, more precisely, an entry in the bank register, which neither you nor Joe control or own.
And that is the problem of the current systems.
To establish trust between ourselves, we depend on third parties.
For years, we’ve depended on these middlemen to trust each other. You might ask, “What is the problem with depending on them?”
The better question would then be: Is there a way to maintain the register among ourselves instead of someone else doing it for us?
The problem is that they are singular in number. If chaos has to be injected into society, all it requires is one person/organisation to go corrupt or a crisis, intentional or unintentional. For instance:
- What if that register in which the transaction was logged gets burnt in a fire?
- What if, by mistake, your account manager writes $1500 instead of $1000?
- What if he does this on purpose?
For years, we have been putting all our eggs in one basket and that too in someone else’s.
Could there be a system where we can transfer money without involving the bank?
To answer this question, we’ll need to drill down further and ask ourselves a better question (after all, only better questions lead to better answers).
Think about it for a second, what does transferring money mean? It’s just an entry in the register. The better question would then be: Is there a way to maintain the register among ourselves instead of someone else doing it for us?
Now, that’s a question worth exploring. And the answer is what you might have guessed already: The blockchain.
It is a method to maintain that register among ourselves instead of depending on someone else to do it for us.
A basic requirement for blockchain to work is that there must be enough people who don’t want to depend on a third party. Only then can this group maintain a register of their own
Are you still with me? Good. Because, now, when several questions have started popping up in your mind, we will learn how this distributed register works.
A basic requirement for blockchain to work is that there must be enough people who don’t want to depend on a third party. Only then can this group maintain a register of their own.
“It might make sense just to get some Bitcoin in case it catches on. If enough people think the same way, that becomes a self-fulfilling prophecy” — Satoshi Nakamoto in 2009
So, how many people are required? At least three. For example, let’s assume 10 individuals want to stop depending on banks or other third parties. With mutual agreement, they have access to details of each other’s accounts all the time — without knowing the person’s identity.
- An empty folder
Everyone keeps an empty folder with themselves to start with. As we progress, all these 10 individuals will keep adding pages to their currently empty folders. And this collection of pages will form the register that tracks the transactions.
- When a transaction happens
Next, everyone in the network sits with a blank page and a pen in their hands. Everyone is ready to note down any transaction that occurs within the system.
Now, if #2 wants to send $10 to #9.
To make the transaction, #2 shouts and tells everyone, “I want to transfer $10 to #9. So, everyone, please make a note of it on your pages.”
Everyone checks whether #2 has enough balance to transfer $10 to #9. If she/he does, everyone makes a note of the transaction on their blank pages.
The transaction is then considered to be complete.
- Transactions continue happening
As time passes, other people in the network may want to transfer money. Whenever they want to make a transaction, they announce it to everyone else. As soon as a person listens to the announcement, she/he writes it on her/his page.
This exercise continues till everyone runs out of space on the current page. Assuming that a page has space to record 10 transactions, as soon as the 10th transaction is done, everybody runs out of space.
It’s now time to put the page away in the folder and bring out a new page and repeat the process from step 2 above.
- Putting away the page
Before they put away the page in their respective folders, they need to seal it with a unique key that everyone in the network agrees upon. By sealing it, they will make sure that no one can make any changes to it once copies of the page have been put away in everyone’s folder s — not today, not tomorrow, not even after a year. Once the page is in the folder, it will always stay there — sealed. Moreover, if everyone trusts the seal, everyone trusts the contents of the page. And this sealing of the page is the crux of this method.
It is called ‘mining’ on the page to secure it, but for the simplicity of it, we’ll keep calling it ‘sealing’
Earlier, we placed our trust in the third party / middleman and believed that whatever they have written in the register will never be altered. In a distributed and decentralised system like ours, this seal will provide the trust instead.
Interesting! How do we seal the page then?
Before we learn how we can seal the page, we’ll learn how the seal works. And a prerequisite to this is learning about something I like to call…
The Magic Machine
Imagine a machine surrounded by thick walls. If you send a box with something inside it from the left, it will spit out a box containing something else.
This machine is called ‘Hash Function’, but we aren’t in a mood to be too technical. So, for today, its is ‘The Magic Machine’
Suppose you send the number ‘4’ into it from the left, it will spit out the following word to the right: ‘dcbea.’
How did it convert the number ‘4’ to this word? No one knows. Moreover, it is an irreversible process.
Given the word, ‘dcbea’, it is impossible to tell what the machine was fed from the left. But, every time you’d feed the number ‘4’ to the machine, it will always spit out the same word, ‘dcbea’.
Let’s try sending in a different number. How about ‘26’?
If we feed ‘26’, we get ‘94c8e’. Interesting! So, the words being spat out can contain numbers too.
What if I ask you the following question now:
“Can you tell me what should I send from the left side of the machine so as to get a word that starts with three leading zeroes? For example, 000ab or 00098 or 000fa or some such word.”
Think about the question for a moment.
I’ve told you the machine is designed in such a way that we can’t estimate what number we must feed it from the left even if we know the expected output we want on the right. With such a machine, how can we answer the question I asked earlier?
I can think of one method. Why not try every number in the universe one after another until we get a word that starts with three leading zeroes?
If we do this, after several thousand attempts, we may end up finding the number that will yield the required output on the right.
It is extremely difficult to calculate the input given the output. But, at the same time, it is always be incredibly easy to verify that the predicted input yields the required output — remember that the machine spits out the same word for a number every time.
How difficult do you think the answer is if I give you a number, say 72533, and ask you the question, “Does this number, when fed into the machine, yield a word that starts with three leading zeroes?”
All you need to do is throw the number in the machine and see what did you get on the right side of it. That’s it.
The most important property of the machine is that — given an output, it is extremely difficult to calculate the input, but given the input and the output, it is pretty easy to verify if the input leads to the output
The most important property of the machine is that — given an output, it is extremely difficult to calculate the input, but given the input and the output, it is pretty easy to verify if the input leads to the output.
We’ll remember this one property of the Magic Machines (or Hash Functions) through the rest of the post.
How to use this machine to seal a page?
Now, we’ll use the Magic Machine to generate a seal for our page. Like always, we’ll start with an imaginary situation.
Imagine I give you two boxes. The first box contains the number 20893. I then ask you, “Can you figure out a number that, when added to the number in the first box and fed to the machine, will give us a word that starts with three leading zeroes?”
This is a similar situation as we saw previously and we have learned that the only way to calculate such a number is by trying every number available in the entire universe.
After several thousand attempts, we’ll stumble upon a number, say 21191, which when added to 20893 (ie 21191+20893=42084) and fed to the machine, will yield a word that satisfies our requirements.
In such a case, this number, 21191, becomes the seal for the number 20893. Assume there is a page that bears the number 20893 written on it. To seal that page (so no one can change its content), we will put a badge labeled “21191” on it. As soon as the sealing number (ie 21191) is stuck on the page, the page is sealed.
The sealing number is called ‘Proof of work,’ meaning that this number is the proof that efforts had been made to calculate it. We are going to call it the ‘sealing number’ for our purposes
If anyone wants to verify whether the page was altered, all she/he would have to do is add the contents of the page along with the sealing number and feed to the Magic Machine. If the machine gives out a word with three leading zeroes, the contents are untouched. If it doesn’t, we can throw away the page because its contents were compromised, and are of no use.
We’ll use a similar sealing mechanism to seal all our pages and eventually arrange them in our respective folders.
Finally, sealing the page…
To seal the page that contains the transactions of the network, we’ll need to figure out a number which, when appended to the list of transactions and fed to the machine, will give us a word that starts with three leading zeroes.
Note: I have been using the phrase ‘word starting with three leading zeroes’ only as an example. It illustrates how ‘Hashing Functions’ work. The real challenges are much more complicated than this.
Once that number is calculated after spending time and electricity on the machine, the page is sealed with that number. If ever someone tries to change the contents of the page, the sealing number will allow others to verify the integrity of the page.
Now that we know about sealing the page, let’s go back to the time when we had finished writing the 10th transaction on the page, and had run out of space.
As soon as everyone runs out of space on the page and can’t write further transactions on it, they will work on calculating the sealing number so the page can be tucked away in their folders. Everyone in the network does the calculation. The first person to figure out the sealing number announces it to everyone else.
As soon as this person shares the sealing number, everyone verifies whether it yields the required output. If it does, everyone labels the page with this number and puts it away in their respective folders.
But what if for someone, say #7, the sealing number that was announced doesn’t yield the required output? Such cases are not unusual. The possible reasons for this could be:
- He might have misheard the transactions that were announced in the network
- He might have miswritten the transactions that were announced in the network
- He might have tried to cheat or be dishonest while writing transactions, either to favour himself or someone else in the network
No matter what the reason is, #7 has only one choice — to discard his page and copy it from someone else so he too can put it in the folder. Unless he puts the page in his folder, he can’t continue writing further transactions, thus, forbidding him to be part of the network.
The sealing number the majority agrees upon becomes the “honest sealing number”.
So, why does everyone spend time and resources doing the calculation when they know that someone else will calculate the sealing number and announce it to them? Why not sit idle and wait for the announcement?
Great question. This is where incentives come in the picture. Everyone who is the part of the blockchain is eligible for rewards. The first one to calculate the sealing number gets rewarded with free money for his efforts (ie expended CPU power and electricity).
For instance, if #5 calculates the sealing number of a page, he gets rewarded with some free money, say $1, that gets minted out of thin air. In other words, the account balance of #5 gets incremented with $1 without decreasing anyone else’s account balance.
When enough people possess Bitcoins, they grow in value, making other people want them. This causes Bitcoins to grow even further in value; making even more people want them and the cycle repeats
That’s how Bitcoin came into existence. It was the first currency to be transacted on a blockchain (ie distributed registers). To keep the efforts on in the network, people were awarded Bitcoins.
When enough people possess Bitcoins, they grow in value, making other people want them. This causes Bitcoins to grow even further in value; making even more people want them and the cycle repeats.
The rewards make everyone keep working in the network.
Once everyone tucks away the page in their respective folders, they bring out a new blank page and repeat the entire process all over again — doing it 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.
Except that there’s one tiny thing I haven’t told you. Yet.
Imagine there are five pages in the folder already — all sealed with a sealing number. What if I go back to the second page and modify a transaction to gain an advantage? The sealing number will enable anyone to detect the inconsistency in the transactions, right? What if I go ahead and calculate a new sealing number as well, for the modified transactions, and label the page with that instead?
To prevent this problem of someone going back and modifying a page (block) as well as the sealing number, there’s a little twist to how a sealing number is calculated.
Protecting modifications to the sealing numbers
Remember how I told you that I had given you two boxes — one containing the number 20893 and another empty for you to calculate? In reality, to calculate the sealing number in a blockchain, instead of two boxes, there are three — two pre-filled and one to be calculated.
And when the contents of all those three boxes are added and fed to the machine, the answer that comes out from the right side must satisfy the required conditions.
We already know that one box contains the list of transactions and one box contains the sealing number. The third box contains the output of the Magic Machine for the previous page.
With this neat little trick, we’ve made sure that every page depends on its previous page. Therefore, if someone has to modify a historical page, she/he would also have to change the contents and the sealing number of all the pages after that, to keep the chain consistent.
Which means if one individual, out of the 10 we imagined in the beginning, wants to cheat and modify the contents of the blockchain (the folder containing the pages with the list of transactions), he would have to adjust several pages and also calculate the new sealing numbers for all those pages. We know how difficult it is to calculate the sealing numbers. Therefore, one dishonest guy in the network cannot beat the nine honest guys.
The longest chain in a network is the honest chain
What will happen is the dishonest guy will be creating another chain in the network from the page he’s trying to modify, but that chain will never be able to catch up with the honest chain — simply because one guy’s efforts and speed cannot beat the cumulative efforts and speed of nine. This guarantees that the longest chain in a network is the honest chain.
When I told you that one dishonest guy can’t beat nine honest guys, did it ring any bell in your head?
What if, instead of one, six guys turn dishonest?
In that case, the protocol will fall flat on its face. This is known as the “51% attack”. If the majority of the individuals in the network decide to turn dishonest and cheat the rest of the network, the protocol will fail its purpose.
What if, instead of one, six guys turn dishonest? In that case, the protocol will fall flat on its face. This is known as the “51% attack”
And that’s the only reason why blockchains might collapse, if they ever do. It is unlikely to happen, but we must all know the vulnerable points of the system. It is built on the assumption that the majority of a crowd is always honest.
And that, my friends, is all there is to blockchains. If you know someone who’s wondering what it is, you know where you can point them to. Bookmark this link.
Can think of someone right now who should read this? The ‘share’ button is all yours.
Subscribe to FactorDaily
Our daily brief keeps thousands of readers ahead of the curve. More signals, less noise.
Subscribe to our WhatsApp Alerts
Mohit Mamoria is a 3x entrepreneur and currently the curator of a weekly newsletter, Unmade, which delivers one idea from the future to your inboxes. This article was first published on Hacker Noon. Updated at 1pm on July 6, 2017, to correct the attribution of the publishing of this article to Hacker Noon. It was earlier written as Medium. Disclosure: FactorDaily is owned by SourceCode Media, which counts Accel Partners, Blume Ventures and Vijay Shekhar Sharma among its investors. Accel Partners is an early investor in Flipkart. Vijay Shekhar Sharma is the founder of Paytm. None of FactorDaily’s investors have any influence on its reporting about India’s technology and startup ecosystem.