1 minute to understand the essence of "blockchain fork"

Reprinted from  1 minute to understand the essence of "blockchain fork"

Many friends have asked, every blockchain node in the world contains all the data, and they all mine qualified blocks on the latest blockchain data. How can two nodes mine new blocks at the same time and the data is inconsistent? What should I do? What to do?

 

Today, I will take 1 minute to introduce to you what a blockchain fork is to answer the above questions.

 

Suppose the current latest blockchain has three blocks:

 

Suppose there is a node in China and a node in the United States, and they have mined mines at the same time (that is, they have found blocks that meet the hash expectations. For details of the mining process, see " Understanding the Nature of Mining in 1 Minute "), both nodes will The mines dug by oneself are chained to their own local blockchain, which leads to a blockchain fork .

 

At the same time, these two nodes will synchronize "I'm mining" with other nodes around the world , so that after other nodes have synchronized the latest data, they can continue mining on the latest blockchain. At this time:

  • Points closer to the Chinese node may be synchronized to the "China chain" first, and continue to mine on the basis of this chain, and the chain will continue to grow

  • Points closer to the US node may first synchronize to the "US chain", and continue to mine on the basis of this chain, and the chain will continue to grow

  • When the node receives the synchronization of two conflicting blockchains, it will judge which chain is longer at this time, and the blockchain with the longer length will prevail.

Voice-over: A longer blockchain consumes more computing power and cannot make most miners "done in vain".


With such iterations, the global blockchain will eventually reach an agreement, whichever is the longest.

Voice-over: If you do not follow the rules, the new mines mined by the "minority" nodes will not be recognized by the "majority", which is equivalent to "nothing". In the blockchain system, "complying with the rules" is all nodes the best strategy .

 

Unless someone masters 51% of the world 's computing power (well, isn't this equivalent to centralization), can they do whatever they want. Blockchains that carry Bitcoin applications are generally considered to be unable to be "subverted" after 6 blocks are chained behind a block, so it is called "six confirmations" .

Voice-over: Well, don't be too happy to mine a new block , and celebrate when 6 other blocks are chained later. The blockchain that carries the Bitcoin application generates a block in an average of 10 minutes, and it takes about an hour for "six confirmations" . How to ensure that a block is generated on average, please refer to " 1 minute to understand how the block is generated at a uniform speed ".

 

Regarding blockchain forks, the concepts of " soft fork " and " hard fork " cannot be ignored.

 

What is a soft fork?

Answer : After the blockchain system is upgraded, before all nodes are upgraded to the latest version, forks may occur due to differences in program versions. As long as the latest version is upgraded, the forks will be eliminated, which is a "soft fork" , the soft fork is temporary .

Voice-over: The original

A temporary fork in the block chain which commonly occurs when miners using non-upgraded nodes violate a new consensus rule their nodes don’t know about.

 

What is a hard fork?

Answer : Some people are hard-headed and do not follow the rules. They pull a branch, and in the name of "morality" or "law", they call on everyone to recognize their own chain and form a fork. This is a "hard fork". A hard fork is a permanent .

 

The most famous hard fork in the blockchain field is the "Ethereum" fork , which is probably like this:

  • Hackers stole about $ 6kw of contract currency

  • The Ethereum development team modified the source code, forcibly transferred the funds in the 1920000th block to another address, and "recaptured" the contract currency controlled by the hacker

  • Most miners agree with this modification, and some miners do not agree with this modification, so two chains are formed, the new chain is Ethereum (ETH) , and the original chain is Ethereum Classic (ETC)

  • Everyone continues to mine on the link that they recognize

Out-of-picture sound:

( 1 ) The version information can be recorded in the block header, so theoretically anyone can change the program and play the upgraded version by themselves, but no one will play with you, no one will play with you, and the mines you have dug are not recognized by everyone, just Just a waste of electricity. In the same sentence, in the world of blockchain, only by obeying the rules can the interests of miners be maximized .

( 2 ) Hard fork, in fact, violates the technical essence of "cannot be modified" of the blockchain, and adopts artificial means to "force rollback". The landlord believes that this violates the technical essence of the decentralization of the blockchain.

 

I talked about four blockchains , and then started to talk about Bitcoin :

  • Why is everyone mining crazy, what's the value

  • What is the essence of Bitcoin

  • Blocks can be generated at a constant speed, why is the total amount of Bitcoin limited?

  • What is the process of bitcoin transaction

 

A minute is very short, I hope this minute, everyone has something to gain.

期待下一个一分钟,有你一起。


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324670484&siteId=291194637