around the world

The most understandable explanation of the principle of the work of the detachment

Characters: Kolya, Vasya, Tajiks and Luda (in episodes).

Photo of stivoberlin, Flickr
Photo of stivoberlin, Flickr

It’s been three years since they started talking about bitkoin really massively. The technology, which is based on accounting for all transactions – blocking – almost all large financial institutions, including Sberbank, managed to get interested, which in itself generates memes .

However, to explain how the blockade works (and bitcoin itself), is still not easy. On the “Leprosoria” tried once again to show on the fingers of the principle of the blockade, and it seems that the user sleep was able to do this as clearly as possible – in the form of a story about Kolya, the diary, and Vasya, who is trying to forge this diary.

Blocking is a diary that is almost impossible to forge

Kolya decided to keep a diary. To do this, he started a notebook and began writing lines like this:

1. I bought bread. I called Gennady … 132. He gave Vasya a loan of 100 rubles. Fucked Luda134. Pokakal

He tried very hard to keep a diary honestly, and if he had a dispute with someone about something that happened earlier, he took it out and poked his whole nose in his notes. Once Kolya strongly argued with Vasya on the topic of whether he gave Vasya 100 rubles or not. At the time of the dispute Kolya did not have a diary with him, but he promised to bring it tomorrow and show everything to Vasya.

Vasya decided not to tempt fate, made his way to Kolya’s house, found a diary, lined up to line 132 and replaced it with “Trahal Olya.” The next day, Kolya took out a diary, searched for it for a long time about the debt to Vasya, did not find it and came to apologize.

A year passed, Vasya was tortured by his conscience, and he confessed to the whole Kolya. Kolya forgave a friend, but decided for the future to use some more reliable recording system, which could not have been so simple to forge.

He thought up the following. In his Linux operating system, he found the md5sum program, which took any text and turned it into a hash-32 incomprehensible numbers. How exactly she did it, Kolya did not understand, but in general it seemed that she gave out a complete rubbish. For example, if you enter the word “hello” in the program, it responds with “8b4609d7e974702ff1451220c7ededcf”. And if you enter, it would seem, almost the same, but with an extra space, then “69ab827825fdb876e709abd3d783dbb6”.

Having scratched the pumpkin, Kolya devised a way to complicate the future Vasya with the replacement of the records in the following way: after each record, he inserted a hash, which turned out if the text of the record and the previous hash were fed to the program. The new diary was as follows:

0000 (initial hash, we restrict ourselves to simplicity by four signs) 1. I bought bread4178 (hash from 0000 and “bought bread”) 2. He called Gennady 4234 (hash from 4178 and called Gennady) … 4492132. He gave Vasya a loan of 100 rubles. Fucked Luda 8204 (hash from 1010 and “Trahal Ludu”)

If somebody now wants to change line 132, the hash of this line will change (it will not be 1010, but something else). This, in turn, will affect the hash line “133. Fucked Luda “(he will not be 8204, but something else), and so on until the end of the diary. Now for the sake of one record Vasya will have to replace the whole diary after it, which is difficult.

Time passed, Kolya opened the bank. He still wrote in the diary of the record “lent” and “borrowed”, supplying them with hashes. The bank has grown, and one day he lent a million (already new) to Vasya. The next night, ten hired Vasya for half a million Tajiks made their way to Kolya’s room, replaced the entry “143313. Has lent to the New Vasya 1000000 “on” 143313. Borrowed New Vasya 10 “and quickly counted all the hashes until the end of the diary.

Miraculously, Kolya discovered a substitution and, as such, decided to complicate the way the diary was falsified: “Now,” Kolya decided, “I will add a number (” nones “) at the end of each bracketed entry, and I will select it so that each hash ended in two zeros. ” The only way to do this is to stupidly dig through the numbers until you get the correct hash:

0000 (initial hash, we restrict ourselves to simplicity by four signs) 1. I bought bread (22) 4100 (hash from 0000 and “I bought bread (22)”, 22 was chosen so that the hash would end on 00) 2. He called Gennady (14) 3100 (hash from 4100 and called Gennady (14)) … 1300132. He gave Vasya a loan of 100 rubles (67) 9900133. Fucked Ludu (81) 8200 (hash from 9900 and “Trahal Ludu (81)”)

To create each Koly record, now, on average, you need to sort out about 50 numbers, which is labor-intensive. Accordingly, if someone replaces the record, falsification of it and all subsequent ones will also be 50 times more difficult, which means that now Vasya can not even cope with Tajiks.

After a while, Kolya took a partner and they both started a diary. For each new record, both simultaneously started to pick a nonce and the one to whom the first was able to find the right one made a record. Since the two to pick nonos faster, Kolya complicated the task and demanded that all hashes end up already three zeros, and not two.

This final Colin diary is in fact a real blockade, only Kolya and his friend have to be replaced by a bunch of computers connected through a network, and it is difficult to compute the hashes so that even computers can be difficult.

Blocking is nothing more than a diary of records that can be recorded together, and in which it is impossible to forge old records de facto.

Having such a cool diary, you can build various interesting systems. For example, bitcoin. Bitcoin is a diary, where each entry looks like “Send so much money from X purse to wallet”. Since the diary can not be faked and the entire history of transfers is stored in it, at any time it is possible to calculate the amount of money on each purse from it. Well, in order to have any money in the system, bitcoin is made so that each entry in the diary ends with the words “Make Z coins and transfer to me”, where “me” is the user who first “guesses” the nonce that will provide hash with the required number of zeros at the end.

Over the diary with some amount of cryptography, you can build other interesting systems. For example, you can make notes in the spirit of “Who decides the equation f (x) = 14, he gets 10 coins.” Accordingly, the first entry in the diary, where the decision will be granted, can automatically be considered the recipient of coins. Around this and similar ideas, so-called “contracts” are being built.

It is worth remembering that the blockade is nothing more than a reliable distributed diary. There are no world problems, apart from those that can be solved by a diary, the blockade will not solve us. And those problems that he decides, he decides at the cost of gigawatts of energy, which are now spent on the selection of “nones” – in large measure, wasted.

Back to top button