What is Blockchain explained simply
My colleagues and friends constantly ask me three questions:
What is bitcoin?
What is blockchain?
Does it make sense to invest in Bitcoin?
I found an “elementary explanation” of how cryptocurrencies work for people who don’t understand programming. The text below is approximately what I’ve been telling all my curious friends and acquaintances.
What is Blockchain?
Kolya decided to keep a diary. He got a notebook and started writing lines like these:
- Bought a hamburger
- Called Vova
- …
- …
- Lent Vasya 100 rubles
- Loved Masha
- Drank tea
Kolya kept his diary honestly, and if a dispute arose about something that had happened before, he would take out the diary and show the entries. One day Kolya argued with Vasya about whether he had lent Vasya 100 rubles or not. But at that moment Kolya didn’t have his diary with him and promised to bring it the next day to prove it to Vasya.
Vasya sneaked into Kolya’s house at night, found the diary, found line 5 and replaced it with “Hugged Olya”. In the morning, Kolya took out the diary, didn’t find the entry about the debt to Vasya, and went to apologize.
A year later, Vasya was tormented by guilt and confessed everything to Kolya. Kolya decided to use a more reliable recording system in the future, one that couldn’t be faked so easily.
And he came up with the following. He found a program called md5sum, which takes any text and calculates its hash function — 32 cryptic digits. For example, if you enter the word “hello” into the program, it returns “8b4609d7e974702ff1451220c7ededcf”. And if you enter seemingly almost the same thing, but with an extra space, it’s already “69ab827825fdb876e709abd3d783dbb6”.
Kolya devised a way to make replacing entries more difficult: after each entry, he inserted a hash obtained by feeding the program the text of the entry and the previous hash. The new diary looked like this:
//0000 (initial hash, showing four characters for simplicity)// Bought a hamburger
//4178 (hash of 0000 and “Bought a hamburger”)// Called Vova
//4234 (hash of 4178 and “Called Vova”)// …
…
//4492// Lent Vasya 100 rubles
//1010// Loved Masha
//8204 (hash of 1010 and “Loved Luda”)// Drank tea
If now some Vasya wants to change line 5, the hash of that line will also change (it won’t be 1010, but something else). This in turn will affect the hash of line “6. Loved Luda” (it won’t be 8204, but something else), and so on to the end of the diary. Now, to change one entry, Vasya would have to rewrite the entire diary after it, which is difficult.
Time passed, Kolya opened a bank. He still wrote “lent” and “borrowed” entries in his diary, supplying them with hashes. The bank grew, and one day he lent (a new) Vasya a million. The next night, ten workers hired by Vasya for half a million sneaked into Kolya’s room, replaced the entry “143313. Lent New Vasya 1,000,000” with “143313. Lent New Vasya 10” and quickly recalculated all the hashes to the end of the diary.
By a miracle, Kolya discovered the substitution and decided to make the diary harder to forge: “Now,” Kolya decided, “I will add a number (’nonce’) in brackets at the end of each entry, and I will select it so that each hash ends with two zeros.” The only way to do this is to brute-force numbers until you get the right hash:
//0000 (initial hash, again four characters for simplicity)// Bought a hamburger (22)
//4100 (hash of 0000 and “Bought a hamburger (22)”, 22 was selected so that the hash ends with 00)// Called Vova (14)
//3100 (hash of 4100 and “Called Vova (14)”)// …
…
//1300// Lent Vasya 100 rubles (67)
//9900// Loved Masha (81)
//8200 (hash of 9900 and “Loved Masha (81)”)// Drank tea
To create each entry, Kolya now needs to try about 50 numbers on average, which is labor-intensive. Accordingly, if someone changes an entry, forging it and all subsequent ones will also be 50 times harder, meaning that now even Vasya with hired workers can’t manage.
After a while, Kolya took on a partner and they both started keeping the diary. For each new entry, both simultaneously started guessing the nonce, and whoever found a suitable one first would make the entry. Since two people guess nonces faster, Kolya made the task harder and required all hashes to end with three zeros instead of two.
This final version of Kolya’s diary is essentially a real blockchain — except that Kolya and his friend need to be replaced by a bunch of networked computers, and hash calculations need to be made more complex so that even computers struggle.
A blockchain is nothing more than a journal of entries that can be written collectively and in which old entries cannot be forged.
With such a journal, you can build different systems. For example, Bitcoin. Bitcoin is a diary where each entry takes the form “Transfer X amount of money from wallet A to wallet B”. Since the diary cannot be forged and stores the entire history of transfers, at any moment you can calculate the amount of money in each wallet from it. And so that the system has any money at all, bitcoin is designed so that each diary entry ends with the words “Produce Z coins and transfer them to me”, where “me” is the user who first “guesses” the nonce that provides a hash with the required number of zeros at the end.
Blockchain is an open transaction ledger stored in hundreds of thousands of copies
Imagine you lend a stranger $10,000 for a year at 10% interest. You got two witnesses and wrote a receipt. A year passed — the witnesses refused to testify (we don’t remember anything, we didn’t see anything, those aren’t our signatures), and the borrower tells you to get lost. To court.
But what if you wrote 5,000 receipts and handed them to 5,000 different witnesses? And all Internet users have access to any of those 5,000 receipts without time or status restrictions. Police, courts, neighbors and relatives can open the receipt and see it as it was written a year ago. Would your borrower still deny it?
To hide 5,000 copies, you’d have to hack each custodian and delete or alter the text of the receipt. But what if there aren’t 5,000 copies, but 2 million? The task becomes nearly impossible.
How are this cunning borrower, the debt receipt, and blockchain connected?
Blockchain is an open electronic ledger. This ledger is installed on the devices of hundreds of thousands of users. When the system adds a new entry to the ledger, that entry automatically appears for all users connected to the system. Changing an entry is not possible. User A transferred the equivalent of $10,000 to user B — this information will be displayed to all users of the system.
All users connected to the system become witnesses to the transfer of the equivalent of $10,000 from user A to user B at a specific point in time.
Information about one such transfer is added to a group of similar information — this is called a hash (if we were writing information in a notebook). A group of hashes makes up the overall transaction hash (if we filed the notebook for February into the common archive). The volume of hashes for a period (100 boxes of notebooks per year) makes up a block. All blocks added to a specific chain are called “blockchain”. Roughly speaking, there is a common archive containing all hashes for a specific day, month, year — any user can find the needed hash and transaction information in this catalog.
The less trust there is in society, the more widespread blockchain will become! An unbiased witness to the creation and storage of any kind of information. The probability that your borrower Uncle Valera will call two witnesses and bribe them to refuse to testify in court is huge.
The probability that Uncle Valera will hack 2 million users and change the transaction information is about zero.
P.S. A couple of useful links about Bitcoin in Ukraine
Exchanges, BTC wallets
BTC exchangers
You can read more about conditions, features, exchange limits and identification in the post “Exchanging and buying Bitcoin in Ukraine”