Lesson №1. Blockchain

Wassap fellows!

Today we want to tell you about blockchain, a technology that can change the world.
And my friend, whose name is Jayden, will help us with this. He is very smart and has already begun to understand blockchain. He will help us with his life examples.

We wrote this post as if we were talking about blockchain to our humanities friends. We can even forward this article to your mom, and she will understand it.

Well, at the end of the article you will find a small test. For completing it you will receive a valuable gift!
Where does blockchain come from?
It all started with the Bitcoin cryptocurrency.
Its creator, Satoshi Nakamoto (although it is not known for certain who he is, since there are assumptions that this is a group of people), wanted to create an electronic money system that would be reliable and secure. Blockchain allows you to do this. Cryptocurrencies themselves are digital money that are based on the blockchain.
Blockchain is not some super-unique service available to a small circle of people. Blockchain is a publicly available technology that will be used by everyone if widespread. Even if you really want to make it, you can even make it on your computer and share it with your friends. Of course, you will have to spend a lot of effort, but your friends will definitely be surprised.
What is blockchain?
Sorry, but we will have to load you with 2 lines of incomprehensible definition, otherwise the Internet geeks will devour us. What is blockchain in vague but precise terms?
Blockchain is a distributed ledger technology that allows information to be stored as a chain of blocks. Each block contains information about transactions that occurred over a certain period of time. Blocks are linked to each other using cryptographic algorithms, making them virtually impossible to change or delete.
Now, what is blockchain in clear and simple terms?
Blockchain is a linked list, where each next link (block) is tied to the previous link (block), thereby creating an endless chain.

If even such a definition seemed too complicated for someone, we turn to Jayden.
Jayden has many friends. Because Jayden was the richest in the company (he saved it from saving on lunches), he often lent money. But as usually happens, the complex cryptocurrency that he was trying to understand did not leave him any free time and Jayden forgot everything about all debts.

Deciding that things couldn’t be done that way, Jayden took a school board, hung it in his room and decided to write down all his friends' debts on it.
Thus, Jayden could always check who owed him and who had already repaid the debt. Approaching the board, Jayden sees that Sean repaid his debt in two transactions, but John, when giving 100 dollars, lied to him that he had fully repaid the debt.

Everything works for Jayden and he is happy with his idea. Now all his friends pay off their debts in full. Everyone is happy except his friends, who are now under total control.

Jayden decides to invite all his friends to his home to celebrate his birthday. He invites everyone he knows, even the worst debt defaulters.
And so, John is at Jayden’s house. Jayen leaves the room for a few minutes where the board with debts is located and John decides to take advantage of the moment. John erases the data from the board and writes another amount there, making it appear that he has fully repaid the debt.
After the party, Jayden decides to check the board and sees that the data has been corrected. Yes, he understands that John owes him — but since there is no data on how much he owes, and John says that he has repaid the debt — it turns out to be impossible to prove that John owes something to Jayden.

Jayden decides to fight such injustice and remembers how everything works in the blockchain.
Blockchain uses data hashing to make it difficult to change, which can be taken advantage of. Hashing is the process of turning one set of characters into a multi-valued set of characters of a certain length.
EXAMPLE

Line: John borrowed $200
Hash: 03d77fcf0ded0e5a962263d01a25eaffda0f524bcf82591ea2c1bb7c603216a3

Line: John borrowed $100
Hash: 555b4ec801155a571ac6bbe42aecd8ef65fdee0dc8839a3e209ccb24990047ae
EXAMPLE

Line: John borrowed $200
Hash: 03d77 fcf0d ed0e5 a9622 63d01 a25ea ffda0 f524b cf825 91ea2 c1bb7 c6032 16a3

Line: John borrowed $100
Hash: 555b4 ec801 155a5 71ac6 bbe42 aecd8 ef65f dee0d c8839 a3e20 9ccb2 49900 47ae
And thus, Jayden hashed all the data on his board.

But, unfortunately, John is too interested in hiding his debts. Knowing what data has been hashed, it is easy to change it, hash it back and write it on the board.
John did just that. Now Jayden will have to make it more difficult to figure out that the cunning John could not deceive him.

It is worth noting that hashing is a one-way process. Finding the hashing source is only possible by brute force, however, on the Internet you can find lists of some well-known word combinations. But the phrase about debt is unique, so the only thing that helped John was that he knew what phrases were on the same lines before hashing.

In order to solve the security problem, Jayden decides to act as follows: Jayden takes the first line, hashes it and gets a certain hash. Jayden adds this hash to the next line and hashes it again.
In this case, if you change even one line, you will have to recalculate the hashes of all the others below in the list. Let’s imagine that John is again at Jayden’s party, and Jayden leaves for a minute from his board with a connected list. This is where John realizes that with such hashing, he definitely won’t have enough minutes to correct the entire list by replacing all the hashes.

However, John decides that he can do this when Jayden is not at home.
John waits for the moment, enters Jayden’s apartment and sits down to change all the hashes. He spends almost all night on this, but in the end he changes all the hashes in the list. In the morning Jayden comes and checks each hash. Surprisingly, all the hashes match and, as a result, John again owes Jayden nothing. Even more, now Jayden owes John.

Now Jayden faces the task of complicating hashing one more level.
Jayden creates a program that generates a very complex equation from mathematics. The answer to each equation will be added to the hash. Let’s give an example of the unrealistically complex equation x-100+1000/500=350 and pretend that it is really very complex. In fact, there will be something like higher mathematics.
No matter how well John knows mathematics, he will not be able to solve such equations overnight and replace the entire table.
In real life, the equations are not very suitable for securing the blockchain. Computers solve them too quickly, and storing millions of unique equations is difficult and expensive. Therefore, the creators of the blockchain came up with another task: to find a number such that the final hash of the record begins with 10 zeros.
Those. instead of the equation, John will have to come up with any number so that the hash simply starts with 10 zeros. Such a number can consist of millions of digits, thereby making the task impossible for John. This number is not easy to find, but its result is easy to verify.

Jayden checks that all hashes start with a given number of zeros. And even if John equips himself with a powerful laptop to calculate hashes, he will not be able to recalculate all the hashes overnight so that they meet the condition. There simply isn’t enough time for this. Such a list is actually a home blockchain created at home. Its security is guaranteed by mathematicians who have proven that these hashes cannot be calculated faster than by brute force. Enumerating hashes for each record is mining, which we will talk about later.
What is centralization and decentralization in blockchain
Let’s now take a look at the whole current situation from John’s side. What if John really didn’t borrow that amount? Suddenly Jayden, perhaps not on purpose, wrote down the wrong amount. In this case, all the friends decide that they should choose the most responsible one among them, so that someone will keep the entire list and check it periodically. In the same way, in EU the EURO and the Central Bank operate centrally. This is called centralization.

Now imagine that such a company expanded to the country, and then to the whole world. Who can now be chosen as the most reliable? Who will store and verify all information? In this case, the creators of the blockchain decided to do the following: everyone who wants to participate in the blockchain begins to keep a copy of the list.
Thus, if there is some repulsed John, he will have to make his way to each user in the night and solve an unknown puzzle. And God forbid, someone will have 2−3 such copies at home. Combined with the fact that the check will be carried out by a soulless machine that cannot be bribed, the task becomes impossible. Almost impossible. This is called decentralization.

Just don’t rush to the side of decentralization. Not everything is as good as it seems at first glance.
Let’s return to Jayden and John. Jayden and John create a decentralized blockchain and add their friends Aiden, Sofia and Mason to it. Each of them has their own copy of the blockchain. John borrows $ 1000 from Jayden for the umpteenth time in order to put an end to it and win the argument. Since there are 5 users on their blockchain, and there is practically no chance of changing everyone’s lists, John goes to the 3 remaining friends: Aiden, Sofia and Mason. He offers them a deal: let’s change the data, write off all our debts to Jayden, and I’ll give you $ 250 for it. The guys agree, change all the lists to new, identical ones, where they do not owe Jayden anything.

Total: 4 friends had a "profit" of $ 250 each, and Jayden not only lost 1000, but was also left without repaying his debts. Why is this so? It’s simple — in decentralization the majority always wins. If 51% have different data from the other 49%, then the data of the majority is accepted as truth. In our example, Jayden was 1 against 4, so, sorry, Jayden, but you were left without money.
INTERESTING FACT
As of November 14, 2023, the number of deployed nodes in the Bitcoin network is 16,754. All of them are scattered around the world, in 93+ countries. To rewrite the blockchain right now, you will need to take possession of 8378 nodes simultaneously. To understand the scale, there are only 1507 nodes in USA.

Do you think this is advisable? Are there enough resources to do this, and if so, how much money will it take to take possession and control them?
How transactions work on the blockchain
We all used electronic money. The funds are in a bank account; a debit or credit card is a kind of key that can initiate a transfer from the bank to the account of the company from which you are purchasing something. When purchasing, we attach the card and enter the card PIN code. After this, the purchase is made. We initiated the transfer, the bank approved the transaction and processed it. The bank records such transactions in its list.

Blockchain works in a similar way, because "John borrowed $ 200" is also a transaction. Only blockchain uses an encryption mechanism through a public and private key.
The public key can encrypt any information so that only the private key can decrypt it back. Let’s schematically draw the same encryption.
The public key in the blockchain is your address in the blockchain. It can and should be transferred to your counterparties, otherwise you will not receive the transaction.

Example: 0×28C6c06298d514Db089934071355E5743bf21d60
The public key in the blockchain is your address in the blockchain. It can and should be transferred to your counterparties, otherwise you will not receive the transaction.

Example: 0×28C 6c062 98d51 4Db08 99 340 71 355 E5743 bf21d 60
A private key is access to the public key of your address. This is a key that cannot be transferred.

If you give away this key, you may lose all your funds. Whoever owns the private key is the owner of the funds. An example of a private key: we hope everyone understands why there will be no example, but visually this key is not much different from the public key, it is the same set of characters and numbers.
If you think this is all too difficult, don’t think that you will have to go through it all. This works with the help of services that do this in seconds, and not even all crypto-fans know about the presence of a private key due to the fact that ordinary users simply do not need it. Everything works automatically.
Let’s think about the problem about Byzantine generals
Imagine an enemy city. You need to capture it. Around him are 4 of your armies, which are led by 4 generals. The city is surrounded by a fortress, which means you need to attack at the same time and preferably after midnight, so that there is an effect of surprise. The distance between your armies is too large to transmit an attack command.

Questions: how to attack a city at the same time? How to make each of the 4 armies go on the attack at the same time?
Solutions options:
1
Give a signal, for example, light a fire, they will see you and suspect something is wrong.
2
Send a messenger, but then how will the army to which he brings the message believe that he is not a fake?
3
Send a messenger whom everyone knows, but how will they understand that he is a fake or that he will not be killed on the road? In any case, the army will be doomed to failure.
4
What if the army general himself is a fake and is interested in the defeat of the army? He can lie about the time of the attack or cancel it altogether.
In general, the whole task comes down to trust and the impossibility of proving the fact that something has been done.
Bottom line: in fact, it is impossible to solve this problem without using blockchain. Blockchain in this problem would solve the issue of proof by the absence of the human factor. The machine cannot be bribed; the algorithm will read mathematical calculations, thereby proving the fact of a transaction or the fact of an offensive on all fronts at 00:00, for example.
How does "address balance" work in the blockchain?
Не переживайте, если у вас тоже нет баланса на карте, так
Don’t worry if you don’t have a balance on your card either, since there is basically no balance on the blockchain.

To be precise, there is a balance itself, but it is not written in the usual form "Your balance: $ 10,000", but something like this "Your balance: $ 5000 from Sasha, $ 5400 from Maison, $ 500 of which you gave to John, of which $ 100 were returned to you".

A little difficult? — Yes
Useful? — No
Safely? — Yes

And with regard to blockchain, the security property negates all previous disadvantages.
Blockchain proves that you have $ 100 simply by the balance sheet, and by proof of transfers of these $ 100 to your account, for example: once Maison and Aiden sent you $ 50, but these $ 50 were never spent or transferred anywhere, and this means that when a transaction is initiated, there must be a corresponding fact that there were no conclusions.

In this example, we see that there are definitely $ 100 on the balance, since the amount of deposits was $ 200, and the amount of withdrawals was $ 100. The income in this example in the blockchain from Maison, Aiden and Sofia is called input, and the recipient of the money, John, is called output.

What is "Double Spending" and how one problem created almost all current blockchains
Imagine that you have $ 100. You can spend it at the store on sparkling water with chips. The store records that you spent this money and adds this record to the blockchain. Now you have $ 0 left (yes, you will have crazy gaming night). But what if you could trick the store and spend the same $ 100 again? For example, you could make a copy of the receipt and show it to another store. This is called double spending.

Transactions on the blockchain do not occur instantly; for example, on the Bitcoin network, it takes an average of 15−30 seconds to complete a transaction, although this time can increase significantly if the network is loaded.
The delay time is needed for the miners to sign the transaction, and while the transactions are waiting for their signature, they hang in the list of unconfirmed transactions, which is called the mempool.

Funds are debited from your address after the transaction is signed. What follows from this: with a balance of 1 Bitcoin, you could send Bitcoin to an address, and while the transaction is confirmed, send the same 1 Bitcoin again to the same address. This is called double spending in the blockchain.
Can anyone guess how this problem was solved? I’ll give you a hint: look for the answer right in the name of the technology. If you haven’t guessed yet, the answer is: BLOCKS.
Blocks in the blockchain (sorry for the tautology, but there is no other way)
Do you still remember Jayden? If yes, then forget him as a person, he became such a pro in blockchain that he evolved into a real computer. Now Jayden is a computer.
So, the entire blockchain consists of such "Jayden"s- thousands of computers around the world that store all blockchain transactions. If you also want to become Jayden, you will have to download all transactions, similar to downloading from Torrent, where downloading occurs from nearby nodes — the same computers, but that own the information.

Transactions are presented in the form of blocks. A block list of the nth number of transactions, which in total weigh up to 2 MB (in relation to the Bitcoin network). Each block has its own date and is added one after another like a chain. Thus, we get rid of the question: which transaction happened before, since blocks are added strictly every 10 minutes.

When our computer downloads the blockchain, it knows which block is the latest. To create a new block, the computer adds a link to the last block in its header. It then calculates the hash of that block and sends it to other computers on the network. Other computers check the hash and, if it is correct, add a new block to their blockchain. And now, everything seems to be clear — a working blockchain, Jaydens are working and recording transactions on the network. But no, it’s too early to rejoice.

Who has already asked the question — what to do if all such Jaydens (computers) simultaneously say that they created a block — well done. And this is where the buzzword comes in handy: mining.
Let’s imagine that you want to write a poem that will contain 10 rhyming lines. This will be a challenge as you will need to come up with words that rhyme with each other and still make sense.
For a computer, the task of adding a block to the blockchain is similar to this. The computer needs to find a number (nonce) that will make the block hash start with 10 zeros. This is very difficult, and even a computer will search for such a number by brute force.

But computers can perform such calculations very quickly, so they can try different nonce numbers until they find one that fits — the only question is how fast the computer can do it. A more powerful computer means more selection options per second.
Mining
Mining (to mine) and any other synonyms (except minecraft) — this is the process of mining tokens by signing transactions.

Mining is when the computer selects a nonce number so that the hash starts with 10 zeros. That is, the computer monotonously goes through hundreds of millions of numbers in search of the same one.
It would take a single computer several decades to find a hash that starts with 10 zeros. But if you combine thousands of computers into one network, the problem is solved much faster. According to probability theory, on average it will be solved in 10 minutes. This is the time it takes to create a new block in the Bitcoin blockchain. Every 8−12 minutes, someone in the world finds such a hash and gets the right to inform the rest of the network about it. This avoids disputes about who came first.

For finding the answer, the computer (as of 2023) receives 6.25 BTC — this is the amount of reward that is generated by the Bitcoin system "out of thin air" and decreases every four years. This reduction in reward is called "halving".
The next Bitcoin halving is expected in April 2024 (do not rush to buy ASICs and video cards; as of November 2023, mining is not of much interest to users without very powerful computers). The exact date is difficult to predict, as it depends on the height of the block. Since a halving occurs every 210,000 blocks, the next Bitcoin halving is expected in April 2024, when the block height reaches 840,000.

Any blockchain lives and exists with the help of miners; without miners, not a single transaction would have taken place, and Bitcoin tokens would not have been mined.

What will happen in 2140 when miners mine the last Bitcoin?
Nothing really critical will happen. Mining will remain, just miners will receive rewards from commissions.

Initially, transactions in Bitcoin were with zero commissions, later commissions appeared and until today inclusive they are growing. Growth is driven by demand. In general, what is hype is what sells.

Probably, some people already have a question: one block appears once every 10 minutes, they pay 6.25 Bitcoin ($ 230,000 as of November 2023), this means that I have a chance of getting 30 thousand $ in 144 attempts daily. Sounds profitable.
In reality, of course, this is not the case. Now computers have reached enormous power, competition has increased tenfold, and the latest 4th generation video card will no longer surprise anyone. You are unlikely to be able to mine a block faster than your competitors on your home computer, because on the other side of your apartment there are entire corporations that will try to pull the rug out from under your feet. For mining in 2023, users gather in groups and mine together.
And now the True Story
Jayden (original Jayden), John, Maison and Sophia once got together to mine Bitcoin. They combined the computing power of their computers and mine Bitcoin from one machine. To simplify the explanation, let’s generalize the power of a computer to its cost:

• Jayden brought a computer for $ 10,000
• John brought a computer for $ 5,000
• Sophia brought a computer for $ 1,500
• But Maison only saved up for an iPod Nano and added the power of the intercom for $ 10 to the mining pool (we're joking, of course, let’s just imagine that Maison has a very bad computer)
Total: one day, friends managed to mine one block. First of all, they were very lucky. Secondly, they received 6.25 BTC. Depending on how much power each friend provided, the reward is distributed.

The above example is a mining pool. It is in the mining pool that various users participate who want to mine at least 1 block in their lives. The more power you provide, the more rewards you will receive. Please note that in the example we carried out too simplified data, usually a mining pool consists of 1000 users who, on average, own less than 0.5% of the reward, giving away all the power.
Well, let’s start testing!
For successful completion you will receive a valuable gift!
START
WHAT IS BLOCKCHAIN?
Next
Check
Find out the result
WHAT IS HASHING?
Next
Check
Find out the result
WHAT IS DECENTRALIZATION?
Next
Check
Find out the result
WHAT IS "DOUBLE SPENDING"?
Next
Check
Find out the result
HOW LONG DOES IT TAKE TO ADD A BLOCK IN Bitcoin?
Next
Check
Find out the result
WHAT IS Nonce?
Next
Check
Find out the result
WHAT IS Mining?
Next
Check
Find out the result
WHAT IS HALVING?
Next
Check
Find out the result
Very bad
Did you even read the article?.. Come on, go back to the beginning.
Take the test again
So-so result...
Not so great yet, but try again!
Take the test again
Hooray!
That's right! You won 10 free crypto wallet checks! Write to us where you want “Academy10” and get your prize.
Take the test again
We also recommend