Around crypto-currency и block a lot of hype, but few people know what kind of game it is and how to explain it in human language. There are a lot of articles on the network about how cool it is to use a crypto, which is a must-have and trend, at the same time, everyone forgets about the main thing - technologies that are much more valuable and can turn our world upside down. In this article, we will understand what kind of beast is blockchain and who needs it at all.
What is blockchain and where did it come from?
Blockchain technology first became known from Satoshi Nakamoto - the creator of Bitcoin. In his article, which described the features of the first cryptocurrency, he told the world about a certain technology that was the basis of this very coin. And although blockchain owes its birth to Bitcoin, it can exist separately from this cryptocurrency. Moreover, everyone can create their own blockchain on their own - this requires only programming skills and a laptop.
Blockchain is a database in the form of a list. In it, all information is recorded as a chain of blocks, which, like train cars, are interconnected. Another example is the blockchain, which can be represented as a diary. Everyone can make entries in this diary, but to change already created data impossible, since each subsequent information is recorded with data about the previous record. If an attacker decides to make some adjustments to the record, then he needs to fake all subsequent notes. That is physically beyond the power of either a person or a computer.
What is the power of the blockchain is easier to explain with an example. Imagine that Kolya keeps a diary in which he writes down all the important information for himself. He writes a variety of notes there, from "went for bread" to "took Vasya 100 rubles." Vasya is not happy that Kolya always remembers his debts, so he decides to enter Kolya’s house at night and forge a note in his diary. Since Kolya writes with a simple pencil, it’s not difficult to correct the entry “took Vasya 100 rubles” to “took Vasya 10 rubles”. Over time, Vasya was tormented by his conscience, and he admitted to Kolya that he had forged the record, so Nikolai was faced with the task of complicating the recordings so that neither Vasya nor Tolik could outwit him.
Since keeping a diary on paper is the last century, Kolya goes to programming courses, where he is taught to turn any text into hashes with the help of an applet - an incoherent set of characters. The program turned any text into rubbish, but the point was that the same text always received the same hash, for example, "0000". It was worth changing at least one letter in the source text and the hash was already different. Kolya took the knowledge acquired at the courses into service and began to keep an electronic diary. In it, he encoded the text under the guise of hashes and wrote down not only his note, but also the hash of the previous note. It turned out "0000 took 100 rubles Vasya." In the next note, he encrypted the previous one and wrote down a new “1234 took 1000 rubles to Tolik”.
Now if Vasya or Tolik want to forge Kolya's diary, then they will have to change not only the entry itself, but also all subsequent hashes to the end of the diary, otherwise Nikolai will notice the catch. It will not be easy to do this - just like Kolya, you need to go to programming courses and learn how to write text with hashes. With this knowledge, Vasya and Tolik can enter Colin's house at night and rewrite all the hashes in a few hours. In the morning, Kolya will find that no one owes him anything, but when he starts checking the hashes, it turns out that they all match. Kolya is not a fool, and in order to strengthen his protection, Kolya decides to add a random number (nons) at the end of each entry, which, when translated into a hash, looks like "00". To make adjustments to Kolya's records, the attackers will need to stupidly select the numbers until they find the one that produces two zeros in the hash. Kolya himself goes through about 50 numbers to find the one he needs, so it will be 50 times more difficult for a cracker to find a nonce to fake a record.
Kolya’s system has become super difficult for hacking, but he decided to take a partner who will help to select numbers to create non-numbers that, when converted to a hash, will already have the form of three zeros. In fact, now Colin’s diary looks like the home version of the blockchain, but in reality it’s not only Kolya and the partner, but a huge number of miners who encrypt blocks with hashes and nons, and the complexity of this encryption increases all the time, which makes hacking the system unrealistic.
Decentralization in brief
We are all borrowing or borrowing ourselves, and if we are talking about a large group of friends who hang out in a bar, then remembering what and who owes it can be difficult. You can entrust the accounting of debts to the most responsible person in the company, who drinks less than others and everyone trusts him. Well, if we are talking about an entire city or country, then relying on the trust in a stranger is the last thing.
In the case of the blockchain, no one trusts anyone - the system is decentralized and a copy of the blockchain is stored by each participant. Neither Vasya nor Tolik will be able to crack such a system, if only for the reason that the attacker will need to get into the house of everyone who has downloaded this database and fake it on each PC.
There is no trust in a decentralized system, and for making changes to the blockchain, they must be accepted by other participants. If most computers checked the block and agree that the hashes and nonse are correct, then new data is written to the blockchain.
When making purchases in the store with a credit card, each time the store through the terminal will request information from the bank whether you have this money on the balance sheet. In this case, the bank acts as the authorizer of the transactions, and in order to get authorization, the client must enter his PIN code, which only he knows. Thus, you can say that you sign the transaction with your PIN code, and the bank approves it or not, depending on whether you have that kind of money.
The blockchain does not have a bank or another authorizer, but there are analogues of pin codes - a private and public key. Each user has a unique private key, which is unknown to anyone and essentially gives access to your money. The public key is the address of your wallet, which can be transferred to other participants, but only from the owner of the private key, transactions will be considered legitimate. When you send a transaction with your public key, you sign it with a private key, as a result of which other participants see that it is their owner who is sending money.
Another feature of the blockchain is that it does not contain information about how much money you have in your account. The blocks contain only information about how much and where it was sent. Confirmation that the participant has money on the balance are links to all previous transactions in his wallet, which are attached to each operation. Thus, a standard blockchain transaction looks like: “Kolya sent me 2 rubles, Vasya gave me 3 rubles, of this amount I want to send 4 rubles to Tolik, and I need to return the change of 1 ruble back to me ”.
As soon as you submit the transaction, the miners will check it with all the links, and if you haven’t managed to spend the 5 rubles that Kolya and Vasya gave you, then it will be approved. This transaction cannot be canceled; the money irrevocably leaves for its intended purpose.
What is mining?
The owner himself could write notes in Colin's notebook, but there is no Kolya in the blockchain - who then makes the notes? They collect transactions in batches and form miners from them, which are not specific people — these are computers. It is they who iterate over the numbers until they find the hashes of the correct form. The more miners there are in the network, the higher its protection and the more work they need to do to find the right solution.
As soon as a set of numbers is found on the Bitcoin network that corresponds to a hash with 10 zeros at the beginning, a new block is formed. It would take decades for such a computing operation to be performed by one computer, and since thousands of computers calculate the hash at the same time, this task is performed approximately every 10 minutes. It is with this frequency that new blocks are born in the Bitcoin system. The miner who solved the problem first receives a reward, the rest receive a notification that the problem is solved and begin to look for a new hash. While the miners are working hard and there is a blockchain - without them its existence is impossible.
Blockchain is not only about cryptocurrencies, it can be applied anywhere. Already today this technology is being introduced in business, manufacturing, medicine, and even at the level of government bodies. In fact, you can shove it into any system where there are participants who cannot trust each other and then intermediaries such as lawyers, bankers, insurers, etc. will go look for a new job. It is only necessary to adapt the blockchain for a specific task and introduce it into our lives.