What is Proof-Of-Work (POW)?
A Description of Proof-Of-Work (POW) by Jack Laskey
Bitcoin is secured by miners who engage in POW. Bitcoin users send data in the form of a transaction to one or more miners. The miners typically share these transactions with the other miners in the network. These pre-validated transactions are stored in what is called the mem-pool. Miners then select transactions starting with the highest fee per byte transactions to validate and include in the next block. To ensure a transaction is included as soon as possible, paying a competitive fee is necessary.
Miners each individually create a block of transactions. These blocks can include whichever transactions from the mempool the miner desires. There is currently a max amount of data that can be included in a block for all implementations of Bitcoin, but Bitcoin Satoshi’s Vison (BSV) is removing this limitation in early 2020. To include a transaction in a block, the miners must verify the authenticity of a transaction using cryptography. If a miner includes a transaction that isn’t cryptographically validated, their block will be rejected by the other miners.
So if each miner is independently creating a block of transactions to add to the blockchain, a chain of these blocks (as the name would suggest), how is one block chosen? Here is where the work in proof of work comes into play. Miners must solve a computation that can only be solved by brute force randomness. Miners take the data of the block the created, that data being a series of 1s and 0s, and appends append a random number, also a string of 1s and 0s, to that data. It The miner then takes that whole string of data and runs it through a hashing algorithm. A hashing algorithm is a unique class of algorithms that takes any string a data as an input and maps that data to a unique integer of fixed length. Bitcoin uses the SHA-256 algorithm which maps any data input to a 256 bit integer, a string of 256 1s and 0s. What is special about a hash is that it is always the same for any input, but it isn’t reverse-engineerable. You can give me an input and I can give you a unique output using a hashing algorithm, but if you give me an output, I won’t be able to know the input.
The miners are competing to discover a nonce, a hash output that starts with a sufficient amount of 0s. The number of 0s required is known as the difficulty level. Miners append 1s and 0s to the data of the block, run that through the SHA-256 algorithm or hash the data, and then hope to get an output that starts with enough 0s. The more zeros necessary, the less likely finding a solution becomes. Once a nonce is discovered, the miner sends the block along with the number needed to append to the block to the rest of the network. The other miners check to make sure the transactions are valid and the nonce works. If these are both true, the miners then add the block to the blockchain and start mining the next block.
The incentive for the miners to try and find a nonce, a process which takes significant computing power and energy, is the ability to claim the transaction fees and the block reward. The transaction fees are paid by users uploading data to the network. The block reward is a transaction the miner sends to themself, which mints a specified amount of new Bitcoins. If the miner tries to mint too many Bitcoins the other miners will reject the block. This block reward decreases over time, but it is an essential element in bootstrapping the network while there aren’t many transaction fees.
So why force miners to spend all of this energy trying to hash the data to get a number that starts with enough 0s? Since there is a cost to creating a block, as long as the majority of the hashpower is acting honestly, the network will be honest. Over time, the honest majority of hashpower is able to outpace a dishonest actor in the creation of new blocks. Since the longest chain is the official chain, ability to go back and change history isn’t feasible since the majority will always be discovering new blocks faster. This means that the more honest hashpower that exists, the more secure the network becomes.
The block reward and transaction fees incentivize miners to add hashpower to the network. Miners which can mine more efficiently and do more hashes quicker and more cheaply will win more block rewards and expand operations. If mining is profitable for new entrants, then hash power will increase that way as well. Miners also want to offer a great product since the equipment necessary to run SHA-256 hashes isn’t reusable for anything else. Since they are paid in Bitcoin, there investment in mining equipment is dependent on Bitcoin remaining valuable and people using the network. This further incentivizes honest behavior. The creation of an economic system that only requires 50% of actors to be honest, and that also makes dishonest behavior unprofitable, was the necessary innovation to facilitate the creation of immutable data, digital money, and trustless trust.