current position:Home>Chat blockchain (IV)

Chat blockchain (IV)

2022-02-03 18:55:56 Hades

Blockchain consensus

Consensus , From this word alone , Our understanding is a decision or idea agreed by a group .
In the world of blockchain , Consensus is a core element .

In the blockchain system , The information is completely public , The network environment of transmission is not safe . However, we need to reach a consensus on the legitimacy and correctness of transmission transactions on multiple blockchains . Traditional transactions rely on the central authority to deal with , It is based on centralized trust , This is obviously not possible on the blockchain .

Therefore, Nakamoto proposed a decentralized consensus mechanism , Consensus is naturally formed , It operates according to specific rules . Driven by each node in the blockchain network . Of course, there are always some problems in each consensus mechanism , No consensus mechanism is perfect . Next, let's talk about the consensus mechanism of bitcoin network :POW( Proof of workload ), Another consensus mechanism for comparing processes is and POS( Proof of interest ), Now Ethereum has switched to POS come up ,POS Not discussed in this chapter

Proof-of-Work Proof of workload

The workload has proved to be carried forward in the bitcoin network , But this theory was not put forward by Nakamoto . It's Adam we mentioned earlier · From baker's paper .

This mechanism is based on the consumption behavior of resources . This kind of algorithm is easy to verify , But at the cost of higher computing costs .

Remember the blockchain header information mentioned earlier ? In the header information “ random number ” and “ Difficult goals ” It is used in the workload proof algorithm . When we confirm a block , use first sha256 Get Merkel root and timestamp information of the block , Then we adjust “ random number ” Get different hash values

We know that calculation consumes computational power , That means consuming resources , that 1 Calculation and of nodes 100 The calculation time of two nodes must be different , Is the block of bitcoin network dynamic ? It is slow to confirm when there are few nodes , If there are many nodes, confirm whether it is fast ? Obviously not so designed , The whole network averages 10 A block will be confirmed in about minutes , The main regulatory factor is “ Difficult goals ”

“ Difficult goals ” This value is to ensure that the time we get the target value is uniform , I didn't go through it 2016 Block , The difficulty will be adjusted once , Ensure average 10 A block will be confirmed in about minutes .

So the workload proved to be through adjustment “ random number ”, Find a hash value , The hash value needs to be less than the target value of the current block .

The target value of the block = Maximum target value / Difficulty value

The maximum target value is a constant :
0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

So we see that the cost of calculating a target value is huge , But it also ensures the security of the system , Increases the cost of destruction .
And the verification process is very simple , Only one hash operation can complete .

Of course, the workload proves that due to the characteristics of the algorithm , Operating efficiency is not high enough , And it will cause a lot of waste of resources , The intuitive performance is the large consumption of electricity , It's not environmentally friendly . Therefore, many consensus algorithms appeared later to make up for and enhance the defects of workload proof .

copyright notice
author[Hades],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202031855518830.html

Random recommended