What Is Proof Of Work?
Proof Of Work, often abbreviated as PoW, is both the method for achieving consensus across the entire Bitcoin network as well as a piece of data that proves that a certain amount of energy, computation, and work has been expended.
One of the most important features of proof of work is the asymmetry between doing work and proving that work has been done. PoW problems are mathematically difficult to solve but easy to verify that they have been solved correctly.
Adding A Block
In order to add a block of transactions to the blockchainWhat Is The Blockchain? The blockchain is the public record of bitcoin transactions, which are organized into blocks that are all chronologically linked to one another. Because every block is..., a bitcoin miner needs to find a number called a nonceWhat Is A Nonce? A nonce, short for "number used once", is a pseudo-random number used by miners to iterate the output of their block hash. Miners use a trial-and-error... (number used once) that can only be found by systematically guessing. With each guess, miners come a little bit closer to finding the number that is needed to add a block of transactions to the blockchain and win the block rewardWhat Is The Block Reward? The block reward is how Bitcoin miners are compensated for mining and adding blocks of transactions to the blockchain. The block reward is made up....
Once a miner has found the winning number, they publish their result and the bitcoin nodesWhat Is A Bitcoin Node? A bitcoin node is any computer that runs the bitcoin software, enforces the bitcoin consensus rules, and validates bitcoin transactions and blocks. Bitcoin nodes are... verify the results. It is computationally difficult for miners to find the winning number but computationally easy for the nodes to verify that the number is correct.
Here is an example of a very simple math problem that simulates PoW.
Multiply 3 prime numbers to equal 52,417.
Hint: All 3 numbers are different and each one is less than 100.
The only way to solve this equation is by trial and error. In order to find the solution, you have to systematically guess hundreds of number combinations until you find the correct answer. This requires you to do work. As soon as you have the correct answer, you can present your solution to anyone as proof that you have done the work.
The answer is 23 x 43 x 53 = 52,417.
Finding the 3 numbers requires systematically calculating dozens or even hundreds of different number combinations. Verifying that it has been solved correctly only requires a single calculation.
This asymmetry is a big part of what makes Bitcoin so secure. It takes a large amount of energy to make changes to the blockchain but a tiny amount of energy to verify that the blockchain is correct.
Consensus
Bitcoin uses proof of work to add transactions to the blockchain because it relies on cryptographic proof rather than trust in any centralized third-party to keep records of who owns bitcoin (such as a bank). In order for all of the bitcoin nodes to come to an agreement on which transactions are valid and which addresses own bitcoin, proof of work is used to achieve consensus.
Since it requires proof of work to add a block to the blockchain, the longest chainWhat Is Nakamoto Consensus? Nakamoto consensus is the mechanism that allows the bitcoin network to maintain an agreement on the state of the blockchain. It is named after Satoshi Nakamoto,... of blocks is considered the one true blockchain by all of the nodes.
When a miner finds the nonce that meets the requirements to add a block to the blockchain, they publish their proof of work and a bitcoin nodeWhat Is A Bitcoin Node? A bitcoin node is any computer that runs the bitcoin software, enforces the bitcoin consensus rules, and validates bitcoin transactions and blocks. Bitcoin nodes are... verifies it. If everything is accurate, the node adds the block to the blockchain and then passes the valid block to other nodes. Once this new block has been recorded by all of the nodes, consensus has been achieved for that block and the miners begin searching for the next block.