28 February 2020
Blockchain being distributed, decentralised and public it is necessary to maintain agreement between all the servers (nodes) in the network. This is maintained by consensus algorithm - a set of rules to be followed by each node. Blockchain consist several blocks of information which are distributed all over the network and each node has the same copy of the blocks. If a new block is added to the chain, that block must be added to all copies of the blockchain. Thus, consensus plays an important role in a blockchain. Each blockchain has its own consensus depending on its functions. The different variants of consensus algorithm are proof of work, proof of stake, proof of burn, proof of authority, etc. Each having different functions. In this blog, we’ll discuss what is proof of work and what importance it carries.
Proof of work is a concept (protocol) originally proposed by Cynthia Dwork and Moni Naor in 1993, but the term was coined in a document by Markus Jakobsoon and Ari Juels in 1999. This innovative way avoids cyber-crimes such as malicious attacks, abuse like spam or distributed denial-of-service attack (DDoS) which has the main aim of raising multiple fake requests and exhausting the resources. POW, as the name suggests, it is proof that a node has to publicly prove that some amount of work is performed while validating a transaction. In other words, POW is a consensus algorithm used by Bitcoin, Ethereum, Litecoin and many other cryptocurrencies that verifies and manages all the transactions in the blockchain.
How does PoW Work?
All the miners in a network run a race to validate the transaction by solving a complex cryptographic puzzle. The first miner to find the solution wins the race and gets a reward in the form of small amounts of BTC and the resulting block gets added to the chain. Once the information about the new block is received by the other miners, they stop solving the present puzzle and move on to another. This process is very time consuming and costly.
While solving the cryptographic puzzle, the miner has to find the value of a nonce (a random number with some data which is added as a salt to the block contents and it can be used only one time), once the puzzle is solved, the resulting block includes previous block address, the collection of transactions in the block, and the nonce which is further pushed into the network for verification by other nodes. The other nodes check the results of the block and if valid they add it to their copies of the blockchain.
This puzzle is asymmetric, meaning that it is easy for nodes to review, but hard for the miners to solve. The more number of miners in the network, the more difficult is to guess the nonce while solving the puzzle. The difficulty of the puzzle is adjusted every 2 weeks in order to prevent inflation. Each new block that is supposed to be added must compulsorily follow the consensus protocol in order to be accepted by the other nodes. PoW ensures that each miner has the same copy of the blockchain and all the transactions are in sync among the other miners.
Advantages of POW:
There is no requirement to trust third party/middlemen
A larger amount of money and computing power is required in order to destroy a system
Disadvantages of POW:
While solving the cryptographic puzzle a huge amount of energy and time is consumed.
PoW is vulnerable to a “51% attack
Hence, Proof of work reveals the miner’s true work for block generation for which miners are rewarded for increasing the number of participants in mining which increases the blockchain network and competition for block generation.