Blockchain: a guide for beginners - how to explain everything to a five-year-old child

in #blockchain6 years ago

We have translated one of the simplest and most accessible guides for understanding the principles of the blockchain device on the example of real life.

Siddharth Malhotra, original on Hackernoon
Today, everyone is talking about bitcoin-from your hairdresser to friends who work in the stock market. Do not worry, in this article we will not, like hundreds of other articles, talk about how to make money with bitcoin. On the contrary, I will try to help you understand the technology underlying the functioning of bitcoin, as well as how useful the concept of blockchain itself will be in the coming decades.

Historical digression
On October 31, 2008, an anonymous person or group of people under the pseudonym Satoshi Nakamoto published a technical description (white paper), which presented an innovative approach to sending money directly from the sender to the recipient, bypassing any financial intermediaries. The document also gives the name of this concept — "bitcoin". Since bitcoin uses some of the foundational concepts of cryptography, this new way of exchanging money has been classified as a cryptocurrency. The only application of bitcoin was financial transactions, but scientists and researchers have realized that the underlying technology can be useful in creating other secure and reliable applications that can revolutionize the way these systems operate now.

This fundamental technology has been called "blockchain". A lot of technical buzzwords? Let's simplify!

What is the blockchain? Real life example
Let's imagine that you live in a city where there is a large Parking lot for 200 cars (assume that this is a one-story Parking lot). This Parking lot has a main gate, which is always closed, except for those moments when the car enters or leaves. And now let's analyze this Parking lot in a slightly different perspective:

Price: since some private company built this Parking lot directly for the purpose of renting out Parking spaces and bears all the costs associated with its maintenance, the cost of renting a Parking space will be high.
Safety: if the robbers get access to the main gate, they can easily get to your car (remove the wheels, drain the fuel, break the brakes-anything!)
A limited number of Parking spaces: For example, the number of cars in the city has increased from 200 to 300 — there will not be enough Parking spaces, and some other private company will have to build a new Parking lot.
Trust: you trust the company that owns the Parking lot, and it is responsible for its safety and reliability.
Centralization: since all machines are located in the same area, this Parking can be considered centralized.
Now let's change the current scenario. Imagine that in your city there are 200 houses and each of them has a garage for two places. But to simplify the explanation, we'll assume that each house has only one car (all cars from our big Parking lot above). Thus, in the garage of each house there is one free space of the two available. Next, imagine that the inhabitants of the city decided to take free space in their garages for rent to those who need a Parking space. This model of distribution of Parking spaces in the city solves the problem of placing an additional 200 or more cars (when people move to or leave our city) without the need to build another, more spacious Parking. As in the previous scenario, let's analyze the following factors:

Price: since initially people did not build a garage in their homes solely for the purpose of renting out Parking spaces, and the cost of maintenance is low, the cost of renting such additional Parking spaces in the garage will be lower than in a large centralized Parking lot.
Security: each car is locked in a separate garage, so the robbers will have to hack all the garages to get access to all the cars, which guarantees higher security (security in the blockchain is a little different, but for simplicity, let's now take it into account in this form).
Limited space: as the number of homes increases and each new home has a vacant garage space, the number of available Parking spaces in the city will continue to grow, which in turn will increase the network of landlords and tenants.
A mechanism that does not require trust: since these distributed Parking spaces are not controlled by any centralized authority, we assume that all garage owners who rent them will agree on certain rental rules.
Decentralization: as indicated in the previous paragraph, Parking spaces are distributed throughout the city, so they can be considered decentralized Parking.
The above analogy provides a basis for understanding the actual technological infrastructure of the blockchain.

From the Parking model to the technical model
The Parking model gives a basic description of the blockchain using a real-life example. Let's now compare the Parking elements from our example and the actual technical model:

A large car Park is a centralized system similar to AWS, Google Cloud, etc. (these cloud platforms are also distributed at some level, but for simplicity we will consider them as a single structure).
Cars are data and applications.
Distributed Parking is a decentralized system, blockchain.
Wait, we're missing something.

All decentralized systems are not blockchain! Yes, blockchain is a specific type of decentralized system with unique characteristics. What? Let's talk about them.

The block chain consists of blocks
Again, let's look at our example with distributed Parking and make a small change in it. Let's assume that a lock in each particular garage is created at the moment the car is standing inside the garage (we assume that the same car uses the same garage every day). Also assume that we have numbered all distributed garages in sequential order. The key from the lock to the garage No. 50 is based on the key from the lock to the garage No. 49, as well as on the characteristics (such as color, weight, engine number, etc.) of the car that stands in the garage No. 50, and the whole process begins with garage No. 1 and continues to garage No. 200 and beyond.

The key to each garage depends on the characteristics of the car in that garage and the key of the previous garage in the list.
Therefore if a robber attempts to crack the garage No. 49, and to change any characteristics of the vehicle, for example, the color or the registration number of the characteristics of the machine out of the garage No. 49 will change, and therefore a new key is generated from this garage, and since the key to the garage No. 50 depends on the key to the garage No. 49, things will change and the key to the garage No. 50, and so on for all subsequent garages.

And now let's make the last assumption that the calculation of the key requires a lot of resources, so if we have to recalculate the key for a particular garage every time the robber will change any of the characteristics of the car in this garage, then recalculate all the keys for all garages will be almost impossible.

What happens when you change the lock-key pair?
I hope you remember what we said: all garage owners adhere to some rules? One of these rules — validation (validity check) of the garage. The garage will be valid if the garage key matches his lock. In case of any changes in the key-lock pair, the key-lock pairs for all subsequent garages in the list will become invalid, since each subsequent such pair depends on the previous one. (The process of validating one key-lock pair for a particular garage is very fast, unlike the key generation process).

This dependence of one pair on the previous one leads to the creation of a chain of garages, and technically speaking, these garages are blocks in such a chain — hence the name "blockchain" (a chain of blocks).

The blocks in the blockchain are connected to the following blocks with a hash — just like the key-lock pairs in our garage example. As in the case of a garage, if the data in one block changes, there is a need for a new hash calculation for all subsequent blocks, and since the hash calculation is a very resource-intensive operation, it will be almost impossible to do so, and thus the network eliminates the appearance of an unvalidated block. The implementation of hash calculations is called "mining", we will discuss it in more detail in the next article in this series.

How do blocks deal with the consequences of changes?
All computers in the blockchain network store a copy of the entire blockchain, so if you change one block or the entire chain on one or more computers, the entire network will try to compare such changes with its own copies of the entire chain.

If most of the nodes (computers) in the network realize that the changed chain is invalid, it will be replaced by a real chain, preserved on other nodes. This makes blockchain networks vulnerable to the so-called"51% attack". Simply put, if more than 50% of the nodes on the network are malicious (or store a modified chain), then it threatens the entire network.