Proof-of-Work (PoW) is the oldest consensus algorithm developed by the pseudonymous identity "Satoshi Nakamoto" who is also regarded as the inventor of the Bitcoin blockchain. Proof-of-work is used by some popular blockchain networks such as bitcoin and ethereum.
It is an algorithm in which one node "the prover", proves to other nodes "The verifiers" that a certainly expected computation is done. The provers then verify the result and if it is accepted by the majority of verifiers, it is considered valid and accepted.
Proof of Work in blockchain
In blockchains, the Proof-of-Work consensus algorithm is used to decide the next block to be added to the blockchain during the mining process. The most common application of the PoW algorithm is the bitcoin blockchain.
In the Bitcoin blockchain, the transactions are grouped in a block to be mined. The block also stores some other information apart from the transactional data such as timestamp, block hash, previous block hash, nonce, network id, Merkle root etc. We won't go into the details of these properties as they're out of the scope of this article.
The nonce value is the solution that every node competes to find first. The nonce value should be such that when it is hashed along with the other block data generates a block hash that contains a specific number of zeroes at the beginning of the hash. The number of zeroes is determined by the current network difficulty at the moment. The miners go through many rounds of trial and error phases until the correct nonce is found.
The solution (here the nonce value) is called the proof-of-work. The miner who finds the nonce first shares it with other peers who then verify if the nonce is valid.
If it is valid the peers then incorporate that nonce value on their local copy of the blockchain and then share it with other peer nodes. This process repeats in a cycle until all the nodes on the blockchain implement that nonce value and add the new block on their local copies. The founder node of the nonce value is rewarded in bitcoins. This is how a new block is added to the blockchain.
Advantages and disadvantages of Proof of Work consensus algorithm.
- PoW is a highly decentralized algorithm. All the nodes also have an equal preference in this algorithm.
- With high decentralization comes high security.
- Slow transaction speeds and expensive fees.
- Very high energy consumption. All the nodes who compete but couldn't find the solution essentially waste energy.
- Mining requires expensive equipment. With the increase in network difficulty, the equipment also becomes less effective.