Page Contents :
Why Do We Need Proof-of-Work
We already understand how nodes communicate and reach consensus in order to add new block to the Blockchain as well as how miners search for hashes to create a valid block.
This process of verification and reaching consensus must consume a lot of computational effort.
That is to say, we must reward miners who put in a lot of effort and computational resources. This is the Proof-of-Work Consensus Mechanism we want to discuss.
Proof-of-Work (PoW) is to find a solution to a cryptographic problem, also referred to as “Mining.”
Finding a hash value less than the Difficulty Threshold requires many time-consuming and complex operations.
It is known as Proof-of-Work because the hash value of the computation’s result can be used by other nodes to prove that the miner has actually put in a certain amount of work.
However, the Proof-of-Work mechanism is not unique to cryptocurrencies.
As early as 1993, the Proof-of-Work mechanism was first proposed by two professors in the United States, which is an anti-spam mechanism specifically designed for spam.
Its characteristic is the small amount of computation required when sending mail in order to prevent the misuse of resources and services.
This mechanism makes each email sent slightly more expensive, which can reduce spam in large quantities.
Satoshi Nakamoto borrowed the PoW mechanism and added mechanisms such as miner incentives to achieve the consensus mechanism of blockchain
The Accounting Process Of The Proof-of-Work Consensus
To put it simply, the bookkeeping process’ PoW is to find a proper hash value, which to prove that the miner has indeed put in a lot of computational work.
The complete flow of PoW:
- Client requests to recorded new transactions to arbitrary node of the network.
- The node will verifies the transaction and broadcasts to the entire network.
- Each node will create a transaction list with the received transaction information and all other ledgers that have not yet been recorded as soon as it receives this request.
Through the Merkle Tree generate a Merkle Root Hash from this transaction list.
- Then assemble it with relevant fields to form an 80 Bytes Block Header that will be used as the PoW’s Input.
- Miners keep changing The Nonce value in the block header, and perform a Double Hashing operation on the block header (ie SHA256(SHA256( block_header_input_value )) ).
- Once the result is Less Than the Difficulty Threshold of the current network (that is, the block is mined! ), the PoW is completed.
- When a node successfully solves a PoW, it has the right to record the transaction and add new block to its chain and broadcasts to its neighbors.
- The neighbor nodes duplicate and continue to propagate this new block, and then at the same time competitive mining for the next block is taking place.
10 Minutes Of Bitcoin’s PoW Computing Power Race
It is widely known that a large number of miners participate in the Bitcoin system.
Here are the steps of Bitcoin’s PoW:
- BTC system uses the PoW mechanism to provide miners a runway for computing power.
- The system adjusts the hash value of the leading 0 to change the Difficulty of the question, ensuring that it takes roughly 10 minutes to solve the PoW.
- This means that the Bitcoin system verifies transactions every ten minutes, and miners can compete again every ten minutes.
- The system will broadcast a Target Value (ie Output Value) to all miners, allowing them to Find Its Input Value.
Because the hash function itself cannot be reversed, the only way for miners to find the input value is to use the method described in the Block Of Blockchain post.
- It is akin to rolling dice: choose a value at random and then compute whether the output Matches the Target Value given by the system.
- If not, try again with the next value.
- There is a considerable likelihood that the miner with the more powerful computational capabilities (i.e., hardware equipment) will roll more dice in the same time and find the right input value first.
- The node will send the answer to the entire network once it has the solution.
- Due to the hash function’s certainty, the hash value obtained by the operation for the same input must also be the same.
- As a result, any node in the network can quickly confirm that the result satisfies the requirements of the system.
- So everyone will agree that this node has got the right to add new block to the chain, and the system will reward all of the bitcoins to its miner.
Computing an output value from an input value is an extremely simple computation that a computer can do very quickly.
The proof-of-work approach described above is the exact reverse of this!
Forks Caused By Proof-of-Work Mechanism
The uniqueness of blockchain data is that miners of all nodes follow the same mechanism.
If some miners do not follow the same mechanism, a fork will occur.
However, here we are talking about forks caused by the PoW mechanism.
In the PoW consensus mechanism, miners compete with each other to find the answer, and whoever finds the answer first will broadcast it to the whole network.
Other miners copy the answer to the back of their ledger and then start a new round of competition.
Since the nodes are connected via various paths across various distances, there will be a problem of network propagation delay.
This means that at the same time, two miners will find the answer and add a new block to their node.
Miners adjacent to the node will copy the new block to their blockchain, and then start new mining in this block.
Hence the fork of the blockchain.
The PoW mechanism solves the problem like this:
- The number of miners on different forked chains is different, and the computing power is also different, so the growth rates of the two chains are not the same.
- After a while, the chain with stronger computing power will be longer than the other chain.
- When miners find that there is a longer chain in the whole network, they are more inclined to choose the longer chain and copy it to their nodes.
- Miners of all nodes will also follow this principle and replicate longer chains.
- This longer chain becomes the main chain, and the forked chain gradually disappears.
Advantages And Disadvantages Of Proof-of-Work Mechanism
The PoW mechanism is highly open and simple, everyone has equal opportunities, and anyone can join the ranks of miners.
Let’s say you provide 10% of the computing power to the PoW consensus and you expect receiving 10% of the mining reward.
However, Bitcoin mining rewards are either all or nothing.
Everyone competes for computing power, and whoever grabs the right will be rewarded.
Let’s discuss the benefits and drawbacks of the PoW consensus mechanism!
- Decentralization: Through the PoW consensus process, the right of adding new block is given to all participating nodes for fair competition.
- Easy to implement: Any node can join without permission, and the consensus algorithm is simple and easy to verify.
- High security: Tampering with the ledger requires 51% of the computing power, and the cost of the attack is greater than the gain.
- Waste of resources: Mining uses a lot of electricity and various computing resources, and everyone does the same thing repeatedly, resulting in a waste of resources.
- Low network efficiency: Confirmations of all transactions take 10 minutes, and consensus requires participation from the whole network.
- Concentration of computing power: In recent years, mining has become a tool for some groups and big players to obtain their huge profits despite the fact that it requires a lot of costs to generate profits.
In the next post, we’ll discuss the new mechanisms that preserve the benefits of Proof-of-Work while addressing its problems.