In cryptocurrency, proof of work(PoW) is a consensus algorithm that requires a participant node to prove that the work done and submitted by them qualifies them to receive the right to validate transactions and add new nodes blockchain. In simple terms, PoW is the mechanism that allows a decentralized network to come to a consensus, or agree on things like account balances and the order of transactions. PoW is the mechanism that prevents double-spending and exploitation on the blockchain.
Consensus
In a blockchain, the consensus is the agreement between all the users(node) to follow some rules to validate transactions on the network.
What is Double-spend?
Double-spending is the risk that a digital currency can be spent twice. Read more on double-spends
How does Proof of Work works?
Technically, nodes(miners) in the network compete against each other in solving complex computational puzzles. This is done by miners guessing a random number known as "nonce", this nonce is combined with data provided from the block and passed through a hash function, if the result produced matches the given conditions, other nodes validate the outcome, the miner's node that solved the puzzle is rewarded and the block is added to the network. The solution to this puzzle is known as a blockhash, every block has a blockhash to show for the work done by the miner, this is why it is called proof of work. These puzzles are difficult to solve but are also extremely easy to validate. Once a miner has solved the puzzle, other miners are able to verify that the solution is correct.
Attacks
The proof of work is susceptible to a 51% attack. This means a miner can have control over 51% of the hashing power on a network and can manipulate the data on the blockchain if this happens.
Pros
- Difficult to find a solution
- Easy to verify the solution
- Safest consensus algorithm
Cons
- Proof of work contributes massively to global warming because the enormous amount of computing power needed for mining is massive.
- Vulnerable to attacks.
Summary
- Miners verify the transactions within the blocks as legitimate.
- Miners then solve a mathematical problem known as the proof-of-work problem.
- A reward is then given to the first person to solve the problem.
- Verified transactions are stored in the public blockchain.
- Proof of work is the safest consensus algorithm.
- Mining consumes uses a lot of computing power, therefore, contributing to global warming.
- Proof of work is prone to a 51% attack.