WHAT IS ‘PROOF OF WORK’

Cryptocurrencies use distributed ledgers-blockchains to record transaction data, a critical process for the whole system to work is reaching a collective agreement-consensus on the content of the ledger. How this consensus is achieved impacts the security and economic parameters of the protocol. A blockchain is a linked list of blocks, with each block containing the hash of the previous
block in the chain. Transactions are bundled into each of these blocks. All full nodes in the network have their own copy of the blockchain in order to maintain the security of the system. A proof of work is the solution to a cryptographic puzzle which contains the previous block hash, the Merkle root of the valid transactions in the current block, and a special transaction called a coinbase which rewards the miner for solving the cryptographic puzzle. Proof of work for Bitcoin is based on:

  • A cryptographic hash functions eg.SHA-256 in Bitcoin
  • Target – maximum possible hash value
  • PreHash – hash of the previous block’s header
  • Diff – difficulty value which scales the target within the hash
  • TxRoot – Merkle root of all transactions contained in the block
  • Nonce – an integer that can be used to brute-force the hash inequality
PROOF OF WORK

Mining is effectively incrementing the nonce until a valid proof of work has been discovered. Once the block is mined successfully, the block cannot be changed without redoing the work. When mining begins, miners pick transactions and use them to generate a Merkle tree. The miner generates a temporary block which has everything determined except the nonce. This temporary block consists of a header and body. The header contains the previous block header hash, difficulty, transaction Merkle root, and timestamp, while the body contains the transaction list.

The miner will continuously put different nonces into the temporary block and compute the hash of the block header until either he finds a valid proof of work or the miner receives a new block from the network, meaning another miner has already validated the current block. Each miner is working separately from other miners. If they are working in the same transaction list, there is a high probability of repeating work, resulting in a waste of hash computing power. Moreover, multiple miners create blocks with the same preceding block, resulting in several valid blocks at the same height in the chain. PoW allows the possibility of forks, where several different blockchains have the same length, yet no chain supersedes other chains. Miners can choose blocks from any branch as their preceding block. The criterion is that only the longest chain will be committed by the P2P network, as the longest chain signifies it consumed the most mining power to generate. The proof of work mining mechanism requires all miner to brute-force the cryptographic puzzle individually. This high amount of work repetition results in a major loss in efficiency.

PROOF OF WORK

Proof of work operates on the principle that it is expensive to add a tranche of new transactions to the blockchain but very easy to check if the transactions are valid due to the transparent nature of the ledger. Miners collectively verify the entire blockchain, and transactions aren’t considered to be fully ‘confirmed’ until several new blocks have been added on top of them. If a malicious actor tries to spend coins fraudulently, those transactions will be ignored by the rest of the network. The only way that an attacker could commit such fraud is to possess a huge amount of computational power, such that they could mine block after block, winning the proof of work competition time after time. This is known as a ‘51% attack’ due to the need to possess more than half of the total network hash rate. The reality is that attempting such a fraud is 1) extremely expensive (since it costs as much as the hardware and energy required, plus the opportunity cost of not supporting the valid version of the blockchain and receiving rewards in return) and 2) extremely unlikely to succeed. Consequently, it is better (i.e. more profitable) for miners to remain honest.

Show Buttons
Hide Buttons