Source: author: Wang Le - LaiW3n links: https://www.zhihu.com/question/37290469/answer/107612456 zhihuCopy the code

The thing is, recently my roommate Hasaki has been asking me about blockchain and bitcoin. I have tried many different gestures to explain to him what blockchain technology is simply and vividly, but in the end, I failed. Therefore, I came up with the idea of writing an article on BlockChain for Babies (also known as how to explain BlockChain to Your retarded Roommate), in order to introduce BlockChain technology or bitcoin to those who do not know BlockChain technology but want to know what it is simply, intuitively and vividly.

Because the readers are people who don’t want to know the specific technology implementation but just want to know blockchain, this paper avoids some low-level and algorithm details and adopts a more subjective way to show the author’s perceptual understanding of blockchain technology. If you’re just interested in blockchain, have no plans to learn more, or just want to be like me when people ask, this should be a good introduction.

The overview

A blockchain is essentially a decentralized, distributed ledger database. It is itself a string of cryptographically related data blocks, each containing valid confirmation of multiple bitcoin network transactions.

This is the definition of blockchain, so to understand blockchain step by step, we need to understand the following step by step.

decentralized

Consider a centralized process first. You want to buy a mobile phone on some treasure, trade flow is: you hit money pay treasure – pay treasure after receiving collection notice to sell a home deliver goods – sell a home deliver goods – you confirm receive goods – pay treasure hit money to sell a home.

Figure 1: Centralized transaction pattern

In this process, although you are dealing with the seller, the transaction also involves a third party besides you and the seller, namely Alipay. The transaction between you and the seller is carried out around Alipay. Therefore, if the Alipay system goes wrong, the transaction will fail. And even if you simply buy a phone, both you and the seller have to provide extra information to third parties. So consider the extreme case, if Alipay runs away or takes the money but doesn’t recognize your transaction or if alipay’s city kicks everyone out because of G20. “Then you’re in trouble.

The decentralized approach is much simpler. You just exchange money and phones with the seller, and both sides claim to have completed the transaction.

It can be seen that in some specific cases, the decentralized processing method will be more convenient, and at the same time, there is no need to worry about the leakage of their information unrelated to the transaction.

In fact, if only two people’s transactions are considered, the benefits of decentralization cannot be fully demonstrated. If thousands of transactions are carried out, the decentralized processing method will save a lot of resources, making the whole transaction autonomous and simple, and eliminating the risk of being controlled by the centralized agent.

Decentralization is a disruptive feature of blockchain technology. It eliminates the need for centralized agents and achieves a direct point-to-point interaction, making efficient, large-scale and non-centralized agent information interaction a reality.

Of course, there is a big potential problem with the above example: how can you guarantee the accuracy and validity of every transaction without a centralized, authoritative agent? For example: if there is no authoritative centralized agency, Zhang SAN one day borrowed 100 yuan from me, but does not return the money does not admit how to do? This brings us to the other features of blockchain.

Two basic puzzles

After decentralization, there is no authoritative centralized agent in the whole system, and the credibility and accuracy of information will face problems.

Problem 1: Type two military problem

The first time I heard of this problem was in a TCP class. It basically said that there were two armies far away from each other trying to send a message, and the Red Army sent a messenger to the Blues and said, “Get your fucking Italian guns out!” . The Blues received the message and sent a messenger to the Reds saying: “Received orders!” . Then the Reds sent another messenger to the Blues saying: “I know you have received orders!” . Then the Blues sent a messenger to the Reds saying: “I know you know I’ve received orders!” . Then the Reds sent another messenger to the Blues saying: “I know you know I know you have received orders!” … And then it just goes on and on.

Figure 2: It is impossible to achieve consistency over asynchronous systems and unreliable channels in distributed computing

In this case, since it is point-to-point communication, it is impossible for the two parties to achieve information consistency in this case. To be precise, “in distributed computing, trying to achieve consistency over asynchronous systems and unreliable channels is impossible”.

Question 2: The Question of Byzantine generals

The Byzantine Empire used a general vote in military action to decide whether to attack or retreat, meaning that if the majority decided to attack, they went ahead. But if there are spies in the army (for example, a general who has defected and deliberately cast a ballot, or a messenger who defected and changed the military order), how can there be any guarantee that the final vote will reflect the will of the loyal general?

The Byzantine general problem is reflected in the field of information exchange, which can be understood as how to verify the accuracy of data transmission in a decentralized system where some nodes are broken and they may broadcast incorrect or non-broadcast information to the outside world.

The birth of blockchain technology

Now let’s solve these problems step by step in a decentralized system and witness the birth of the prototype of blockchain technology.

1

Let’s start with A decentralized system. To make things easier to understand, let’s look at A simple decentralized lending model: If A borrows $100 from B, at this moment, A shouts in the crowd “I’m A, I lent $100 to B!” “B also shouted in the crowd” I am B, A lent me 100 yuan! At this time, passers-by A, b, b, d heard the news, so everyone silently wrote down “A lent B100 yuan”. You see, A decentralized system is set up that requires no banks, no loan agreements, no receipts, and, strictly speaking, no long-term trust between people (e.g., “I don’t owe A money!” “That’s when people come out and say,” No, my little book says you borrowed $A100 the other day!” ).

Figure 3: Decentralized lending model

2

As you may have noticed, in the above model, the “$100” doesn’t matter. In other words, anything can be exchanged in this model, and you can even make something up out of thin air, so long as everyone acknowledges it, you can make it circulate. For example: I shout “I made 10 Chakras!” in the crowd. I don’t even need to know what chakras are or care if there are any chakras in the world, as long as everyone hears them and writes down in their little notebooks “LaiW3n has 10 chakras” and I have 100 chakras. From then on, I can claim to have given someone a chakra, and as long as passers-by receive and acknowledge the message, I have completed the transaction, even if there are no chakras in the world.

Are there three words that come to mind right now — bitcoin? Since the real Blockchain and Bitcoin are much more complex and detailed than my model above, I will take Chakra as an example. After all, this article is Blockchain for Babies.

3

Let’s say that after a long time, the Chakra THAT I created out of thin air has been circulating through the system, and everyone has started to recognize Chakra. But there are only 10 chakras in the system, so someone took a bad turn and shouted “I have 10 Chakras!” in the crowd. How to do? Did everyone just write down that he had 10 Chakras in his notebook, so that everyone could fake chakras?

In order to prevent this kind of phenomenon, I decided to when I create a chakra to my chakra branding (more precisely, I am give me shout that sentence “I created 10 chakra” branding, such as marked as 001), after that at the time of every transaction, I’m Shouting “I gave it to such and such a chakra!” “, with an additional note: “The source of this chakra is the record marked 001. My sentence is marked 002!” . Let’s get a little more abstract, someone Shouting the content of the format becomes: “this sentence number XXX, the number of the last sentence is YYy, I gave so-and-so 1 chakra!” This solves the problem of forgery. In fact, the above model becomes a simplified version of satoshi Nakamoto’s first version of bitcoin blockchain protocol:

Figure 4: Comparison of Chakra model and Satoshi Nakamoto’s first version of blockchain protocol

Okay, so you’re basically able to explain blockchain to your retarded roommate visually and without any detail. But your roommate may be a sticker-to-the-wall student, so you’d better keep answering these questions.

1. “Why?”

Your roommate may ask, “Why should I take notes when you shout? Is my little book free?” . To encourage you to help me with my message and bookkeeping, I’ve decided to give a prize to the first person who hears my message and writes it down in a notebook: The first person to hear my answers and record down, you just got a chakra, this chakra is the whole system for you fortunately, billing, and if you record this sentence after, want to tell other people you’ve had a good record right away, let others give up continue to record the words, and give your own record number let others well documented, And then you call out my words with your record number for the next person.

When this rule is set, there will be a group of people in the system who will start listening for noises around them to claim the right to be the first to charge. Right, did the words “bitcoin mining” spring to mind again?

It’s worth noting that bitcoin mining,

@Linglong Evil Monk

Here’s a good example:

Single wang people want to find female tickets, the national mother-in-law said I have a lot of daughters, so I give you a point topic, solve a micro signal to one of the girls.

Single wang crazy competition, want to head to solve the problem. As long as one of them wang solve a problem, immediately proudly announced to the world, demonstrating all single wang, this girl is mine, you give up. Other single wang people even if disobey also have no way, disconsolate be upset also is not a thing, still hemp slip ground solves next topic immediately. The lucky girl was a winner when her mother-in-law recognized her and gave her 25 yuan as a bride price.

2. “Listen to who?”

In this system, if I and another person C shout out, “For Azeroth! . Depending on where the audience is, someone must have heard my sentence first and someone else heard C. If only one person is allowed to say this sentence, who actually said it?

Without any conditions, the above situation must go something like this: some people think I said this, and after hearing this, they start keeping accounts, and then everything they do is based on this fact, and the chain of information gets deeper and deeper as the information is passed on and on. And the other group of people who think C said it first will follow the same trend. So what had been a single chain of information split when we shouted “For Azeroth!” ?

Figure 5: “blockchain” forks

Where does this lead? The idea is that everyone’s little notebook should have the same thing on it, a chain that connects all the information. But at this moment, their little books are different! What the hell is that? How to determine the authenticity of transactions and information in the future! ?

In order to solve this problem, I have added a new rule: when everyone is recording the small notebook, he/she needs to take off his/her shoes and hold the pen with his/her feet and write in regular script on the small notebook! With this rule, because it is very difficult to write with your feet, everyone needs at least 10 minutes to finish writing, and because everyone is not proficient in writing with their feet, the time it takes to finish writing this sentence is different, so there must be someone who finishes writing first and shouts “I have finished! It was LaiW3n who shouted that!” “So that the other person writing the sentence will stop and start over on their little notebook:” That sentence is from the communication. The previous sentence is numbered XXX.”

If you are interested in my solution above, you can compare my analogy with the following:

“Whose way is it?” — Satoshi Nakamoto’s algorithm for solving the “Byzantine General Problem”

“Record on a little notebook” — Bitcoin mining

“Take off your shoes and write with your feet” — The difficulty of bitcoin mining

“Writing speed with shoes off” — calculating power

“New rules” – Proof of work chain

3. “Double flower” problem

At this point your roommate may ask: What if I announce that I gave A Chakra to A and I gave A Chakra to B, but I only have one chakra? Did BOTH A and B receive chakra or something?

All you have to do is hold his chin, look him in the eye, scratch his nose, and say, “Goblin, why don’t you take this to the rule above?”