Approaching Bitcoin: A story to read "blockchain"

Source: Internet
Author: User

Blockchain is the underlying technology and infrastructure of Bitcoin, essentially a de-centralized database. A blockchain is a series of data blocks that are associated with a cryptographic method, each of which contains information about a bitcoin network transaction that verifies the validity of its information (anti-counterfeiting) and generates the next chunk.

In the narrow sense, blockchain is a kind of chain data structure which is combined in sequential way by time order, and the non-tamper and non-forgery distributed ledger is guaranteed by cryptography.

The above definition is from Baidu Encyclopedia. Many novice friends read this explanation is still full face, what is the "blockchain"?

Cause

Unless you've never been in touch with information security, you must have heard of bitcoin and blockchain. After all, these two nouns are the hot words that have been reported by the media at home and abroad for nearly two years. In particular, after the outbreak of the Wannacry virus in May this year, many people who have never been in contact begin to join the discussion army.

Many of my friends don't know anything about technology. In the last few weeks, they have become curious babies, around me asking for bitcoins and blockchain. I think the heat of the two nouns will continue to climb, and there are many more people who don't know enough about them. Why not use popular language to explain the "blockchain" and spread the concept?

And the general interpretation of the Internet is different (regardless of 3,721, the next definition, in fact, there is no egg), we use its role as a starting point to understand the working mechanism of the blockchain.

The beginning of the story

Joe is your best friend. On the fifth day after he traveled abroad, he called you: "brother, I need some money, I will spend all my money after going abroad." ”

You reply: "I call immediately", then hung up the phone.

Then you call your bank Account Manager: "Please get your account transferred to Joe for $1000 right away." ”

Account Manager: "OK, understand." ”

The account manager then confirms that there is sufficient balance in your accounts. Because you are a millionaire, the account manager does the following:

Transaction Billing

You called Joe and said you've turned over 1000 dollars.

Let's look back and see what happened just now. Both you and Joe Trust the bank to manage your own possessions. There is actually no physical flow of real money throughout the process. The whole process involves only two accounts entered into the system. To be more precise, the whole process can be completed with only two accounts of the bank.

In such a traditional monetary system, my problem is coming.

The trust mechanism of the Parties to the transaction is established with the help of third parties. This "middleman" is a long-standing way. Then you might ask, "What's wrong with this trust mechanism?" "The problem is that" supervisors "other than the two sides of the bargain are just individual individuals. The following risks may exist in this situation:

1. If a person or a third-party organization is destroyed intentionally or unintentionally, it may be enough to cause social disruption. 2. What happens if the registry of a transaction is recorded in a fire? 3. What if your account manager accidentally crossed $1500 to your friend's accounts? 4. What if he did this on purpose?

Is there a system in the world that can help us to complete secure transfers without having to use a bank?

To solve this problem, we should first calm down to think carefully, ask ourselves a deeper question: Can we own the account and historical transaction information?

This is indeed a question that deserves to be explored. The answer, of course, you must have guessed--that is, "blockchain." Now we're going to start learning how this distributed ledger works.

The development of the story

The necessary condition for the implementation of this approach is that there must be enough people willing to trade without relying on third parties. Only in this way can this part of the people be able to control the ledger data themselves.

What is the number of people that is enough to achieve? In the following example, we assume that there are 10 people willing to abandon a bank or any other third party. On the premise of agreement between the two sides, they are able to keep abreast of each other's status without knowing each other's information and dynamics of each other's account.

1. An empty folder

At first everyone will get an empty folder. As time goes on, these 10 people will continue to add paper that records trading information in their now empty folders.

2. When a transaction occurs

Next, everyone in the trading network sits down with paper and a pen and prepares to record every transaction that takes place in the system.

Suppose, number 2nd wants to give 9th to $10.

In order to complete the deal, number 2nd loudly told everyone: "I'm going to turn 10 dollars to number 9th." Please write it down on your paper. ”

Then everyone checks to make sure that number 2nd is not 10 dollars and above the balance can be transferred to 9. If the balance of number 2nd is sufficient, then everyone records the transaction on blank paper.

The first deal on paper

The deal is done in this way.

3. Transactions that continue to occur

With the passage of time, there are more and more people in this trading network that are in need of trading. Whenever they generate a trade demand, they will notify everyone on the network. As soon as someone hears the notice, he or she will record it on their own paper.

The process will continue until there is not enough space on this piece of paper. Assuming that each piece of paper can only record 10 transactions, then as long as the 10th transaction is completed, everyone's space on the paper will be exhausted.

When the white paper is filled

At this point we need to put this piece of paper into the folder and take out another new sheet of white, repeating the process of step 2 above.

4. Put the paper in the folder attention point

Before putting the paper in the folder, we need to seal the paper with a proprietary key that everyone in the network recognizes. But after the seal we have to make sure that this piece of paper can only be sealed in the folder, no matter who can make any changes to it at any time. And if everyone believes in the "seal," then it means that everyone is absolutely trusting of the content on this piece of paper. This sealing method is also the key to the blockchain.

In the past, third parties or intermediaries have persuaded us that no matter what they record in the registry, the content will not change. But in today's distributed, decentralized system, this seal (key) establishes this trust mechanism for us.

The climax of the story (I.)

The new question has come again. How should we seal this piece of paper?

Before learning how to seal, let's start by understanding how the seal works.

Suppose we have a machine now, and if you put a box with something in it from the left, the magic machine will spit out a box with something else on the right.

"Term resolution" this machine is actually called a "hash function", but today we don't discuss technology. So we call it "the Magic machine" for the moment.

Magic machine (i.e. hash function)

If we put the box containing the number 4 from the left, it will give the following characters from the right: Dcbea.

If the condition is known to be output as "Dcbea", it is difficult to know what is entered from the left. But every time you put 4 in, the final output "Dcbea" is positive.

Let's try to send other numbers. What would you get if you put it in 26?

Hash (=94c8e)

This time we get the "94c8e". Judging from the output of 26, the result can also contain numbers.

Knowing here, we can start thinking about the next deeper question:

"If I want to get a result from the right that starts with 3 zeros (such as 000ab, 00098, 000FA, etc.), what should I put from the left side of the machine?" ”

Predicting what to enter

This machine has a one-way property: After giving the expected result on the right, we can't figure out what to put on the left. Does that mean there's no solution to this problem? Or not.

I can think of a way of typing each number again until the machine outputs a result that starts with 3 zeros.

Try all the numbers again.

The patient who tried it thousands of times might have found the number that meets our output requirements.

It is really difficult to get the input numbers by outputting the results. But if we get the input of the predictions, it's very easy to verify that the input will produce the results we want. Remember, the biggest feature of this machine is that each result corresponds to only one number, no exception to "monogamy".

If I give you 72533 this number and then ask you: "Does this number enter the magic machine and will output a result that starts with 3 zeros?" "The problem is simply insulting our IQ.

So the most important attribute of this machine is--knowing the result, it is very difficult to figure out the output, but if we know the number and output of the input, it is easy to verify whether the two match.

How to use this machine to seal paper?

How do you use a magic machine to generate a unique seal for every piece of paper? Still the old way, use the method of situation simulation to unfold explanation.

Let's say I gave you two boxes. The first box has the number 20893, can you think of a number, this number and the number of the first box after the addition of the result into the magic machine, we can get a 3 zero to start with the result of a character.

This scenario is almost the same as the previous puzzle. The only way to do that is to put each number in the machine and try it again.

After thousands of attempts, we will stop at this number 21191, 21191+20893=42084, and put 42084 into the machine after the result is what we want.

In this case, the number 21191 is the "seal" of the number 20893. Suppose there's a piece of paper that says 20893 of this number. To seal this piece of paper (i.e. no one can make any further changes to its contents), we attach a 21191-tag badge to the paper and seal it.

Sealed numbers

The "term resolution" used to seal the numbers is actually referred to as "proof of work (Proof of Works)", because this figure is calculated by effort. In order to be easy to understand, we call it "sealed number".

Whoever wants to verify that the page has been altered, simply overlay the content on the page with the sealed number and put it on the magic machine. If the output of the machine starts with 3 zeros, then the content of the page is not "contaminated". However, if the results do not meet this feature, we should decisively discard this page, because the above content has been changed, has been invalidated.

Seal Process Summary

To seal a page that records the flow of transactions across the entire trading network, we need to find the key number of the character that starts with 3 zeros when the transaction is added and the machine is entered.

Note: "Characters that start with 3 zeros" are just an example of how the hash function works simply. Practical problems are much more complex to deal with.

As long as it takes a certain amount of time, the participants in the trading network can calculate the number, and the page is sealed. Once someone changes the content on the page, anyone can verify the integrity of the page with this sealed number.

The climax of the Story (ii)

Once we know how to seal the page, we'll pull back to 10 people when they're done with all the space on a piece of paper.

When more transactions are not recorded on this page, everyone in the trading network stops to calculate the sealed number for that page, and then puts it in the folder. If the first person has a sealed number, he will announce it to everyone.

After hearing the sealed number, everyone verifies that the number meets the output requirements. If so, place the label on their page and put the page in the folder.

But if number 7th calculates the seal number and "announcing the world", it turns out that this number doesn't meet their output requirements. This is also a common situation. There are several possible reasons for this:

1. The disclosure of the transaction information is wrong;

2. A clerical error occurred while recording the transaction information;

3. Make a mistake when recording the transaction for your own benefit.

For whatever reason, number 7th has only one option-discard this piece of paper, then copy a copy from someone and put it in his own folder. If you don't put this page in a folder, he won't be able to keep track of the next transaction, which is tantamount to kicking him out of the trading network.

Speaking of which, I believe that some people in the human brain have another doubt: since someone calculates the seal number will be published, why each of us spend so much time to calculate again? Why do others not rest and wait for the announcement?

Good question! blockchain contains a special reward mechanism that everyone on the network is eligible for. The first person to calculate a sealed number can get a certain reward.

Let's just say that if number 5th is the first to figure out the seal number for the page and get a $1 reward, then the $1 is out of nowhere. In other words, if the balance in his account is $5, it is now $1, but the $1 has not been deducted from anyone else's account, that is, no one's account balance has been reduced.

This is the origin of Bitcoin. It is the first currency in which transactions occur on a blockchain (distributed account). If you continue to work on this trading network, you can also get rewards, and this process is what we call "mining."

More and more people have bitcoins, these people do not idle at the moment to start to fry this virtual currency, and constantly expand the market demand for Bitcoin, and further improve the value of Bitcoin. In this way, the price of bitcoin is scrambled very high.

This reward mechanism allows everyone in the trading network to work diligently.

They put the paper in the folder, took out a new blank paper, and then repeated the previous process-the cycle, endless.

Assume that there are already 5 sealed pages in the folder. What happens if I change one of the trades on the second page for personal gain? As already mentioned, everyone can find out what the deal has changed by sealing the number. But what happens if I recalculate the seal number based on the modified content and then paste the new number on the paper?

To prevent someone from modifying the page and the seal number at the same time, there is a trick to calculating the seal number.

How to prevent the seal number from being recalculated and changed?

Remember before I assumed you had two boxes, one containing 20893 and one for the calculation of empty boxes? To calculate a sealed number in a blockchain, there are actually three boxes instead of two, of which two are content and one is filled for calculation.

When the contents of the three boxes are filled into the machine, the result of the machine's right output can meet our needs.

A box is a transaction record, a box is a sealed number, and the third box is the output of the previous page computed by a hash function.

With this tip, we can ensure that each page's sealed number is associated with the contents of the previous page. So if someone modifies the content of the history page, he needs to change the seal number on each page to ensure consistency across the link.

We assume that one of the 10 people who wants to maliciously modify the contents of the blockchain (including the folder that recorded the transaction history page) needs to adjust many pages to calculate the seal number of all pages after the change page. We all know that it is very difficult to calculate the seal number. As a result, a traitor in the entire trading network will eventually lose the remaining 9 good guys.

Starting with the traitor's page that wants to change the content, he needs to create another blockchain across the network, but the blockchain is almost impossible to catch up with the links that people create--a person's power is not up to the 9 remaining people. Therefore, it is very clear that the larger the blockchain size, the higher the security and reliability.

But what if 10 out of 6 people have defected?

If this happens, the deal is a bit of a face. This is known as a "51% attack". If most people in the network decide to rebel and deceive less than half of the people, then the whole agreement will naturally go to extinction.

This is the biggest weakness of the blockchain. Although such a situation is unlikely, we should keep in mind the weaknesses of this system. The whole system is based on the assumption that most people in the entire trading network will not rebel.

Ending

The explanation is almost there. Also please look back to my dear people to see the definition of Baidu Encyclopedia, now is not easy to understand a lot?

If anyone asks what the blockchain is, how Bitcoin works, I'm sure the readers of this article will be able to explain it to more small whites.

Approaching Bitcoin: A story to read "blockchain"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.