Proof of Work (PoW) Consensus
The idea for Proof of Work(PoW) was first published in 1993 by Cynthia Dwork and Moni Naor and was later applied by Satoshi Nakamoto in the Bitcoin paper in 2008. Proof of Work consensus is the mechanism of choice for the majority of cryptocurrencies currently in circulation. The term “proof of work” was first used by Markus Jakobsson and Ari Juels in a publication in 1999.
Principle: A solution that is difficult to find but is easy to verify.
The purpose of a consensus mechanism is to bring all the nodes in agreement, that is, trust one another, in an environment where the nodes don’t trust each other.
All the transactions in the new block are then validated and the new block is then added to the blockchain. Note that, the block will get added to the chain which has the longest block height(see blockchain forks to understand how multiple chains can exist at a point of time). Miners(special computers on the network) perform computation work in solving a complex mathematical problem to add the block to the network, hence named, Proof-of-Work. With time, the mathematical problem becomes more complex.
How PoW works?
An edX course describes on Blockchain PoW as:
“The Proof of Work consensus algorithm involves solving a computational challenging puzzle in order to create new blocks in the Bitcoin blockchain. Colloquially, the process is known as ‘mining’, and the nodes in the network that engage in mining are known as ‘miners’. The incentive for mining transactions lies in economic payoffs, where competing miners are rewarded with 12.5 bitcoins(at the time of writing this article; this reward will get reduced by half its current value with time) and a small transaction fee.”
The process of verifying the transactions in the block to be added, organizing these transactions in a chronological order in the block and announcing the newly mined block to the entire network does not take much energy and time. The energy consuming part is solving the ‘hard mathematical problem’ to link the new block to the last block in the valid blockchain.
When a miner finally finds the right solution, the node broadcasts it to the whole network at the same time, receiving a cryptocurrency prize (the reward) provided by the PoW protocol. At the time of writing this article, mining a block in the bitcoin network gives the winning miner 12.5 bitcoins. The amount of bitcoins won halves every four years or so(thats how the bitcoin network is designed). So, the next deduction in the amount of bitcoin is due at around 2020-21(with the current rate and growth).
With more miners comes the inevitability of the time it takes to mine the new block getting shorter. This means that the new blocks are found faster. In order to consistently find 1 block every 10 minutes (That is the amount of time that the bitcoin developers think is necessary for a steady and diminishing flow of new coins until the maximum number of 21 million is reached (expected some time with the current rate in around 2140)), the Bitcoin network regularly changes the difficulty level of mining a new block.
To see more about what a block contains, visit Blockchain Explorer through Google for more interesting surfing
The fact that Block GFG1 is connected to Block GFG2 through its hash number is important. The significance lies in the fact that this ‘hash number’ connects new block to the last block in the valid blockchain. If, on the other hand, the Block GFG1 Hash number on Block GFG2 had a different hash number than Block GFG1 they would not match up, and Block GFG2 would not be verified.
First block in the blockchain is called the Genesis Block and has no Prev Block Hash value.
Changing a block (which can only be done by making a new block containing the same predecessor) requires regenerating all successors and redoing the work they contain (amounting to calculating the entire chain of ‘hard mathematical problems’) which is practically impossible. This protects the blockchain from tampering.
Bitcoin’s Proof-of-Work system:
Bitcoin uses the Hashcash Proof of Work system as the mining basis. The ‘hard mathematical problem’ can be written in an abstract way like below :
Given data A, find a number x such as that the hash of x appended to A results is a number less than B.
The miners bundle up a group of transactions into a block and try to mine. To mine it, a hard mathematical problem has to be solved. This problem is called the proof of work problem which has to be solved to show that the miner has done some work in finding out the solution to the problem and hence the mined block must be valid.
The answer to the problem needs to be a lower number than the hash of the block for it to be accepted, known as the ‘target hash’.A target hash is a number that the header of a hashed block must be equal to or less than for a new block, along with the reward, to be awarded to a miner. The lower a target is, the more difficult it is to generate a block.
A miner continues testing different unique values (known as nonce(s)) until a suitable one is produced.
The miner who manages to solve the problem gets the bitcoin reward and adds the block into the blockchain by broadcasting that the block has been mined.
The target hash adjusts once every 2016 blocks or approximately once every 2 weeks. All the miners immediately stop work on the said block and start mining the next block.
Common cryptographic protocols used in Proof of Work systems:
The most widely used proof-of-work consensus is based on SHA-256 and was introduced as a part of Bitcoin. Others include Scrypt, SHA-3, scrypt-jane, scrypt-n, etc.
Features of Proof of Work system:
There are mainly two features that have contributed to the wide popularity of this consensus protocol and they are:
- It is hard to find a solution for the mathematical problem
- It is easy to verify the correctness of that solution
Main issues with the Proof-of-Work consensus:
The Proof-of-Work consensus mechanism has some issues which are as follows:
- The 51% risk: If a controlling entity owns 51% or more than 51% of nodes in the network, the entity can corrupt the blockchain by gaining the majority of the network.
- Time consuming: Miners have to check over many nonce values to find the right solution to the puzzle that must be solved to mine the block, which is a time consuming process.
- Resource consumption: Miners consume high amounts of computing power in order to find the solution to the hard mathematical puzzle. It leads to a waste of precious resources(money, energy, space, hardware). It is expected that the 0.3% of the world’s electricity will be spent to verify transactions by the end of 2018.
- Transaction confirmation takes about 10–60 minutes. So, it is not an instantaneous transaction; because it takes some time to mine the transaction and add it to the blockchain thus committing the transaction.
Cryptocurrencies using PoW:
- Monero coin
Other alternatives to the PoW consensus:
These issues have led to the development of new consensus protocols like:
- Proof of stake
- Proof of burn
- Raft consensus
- Federated consensus
- Proof of activity
- Proof of elapsed time
- Proof of capacity
- Proof of importance