Foundations · Blockchain

Proof of Work

Proof of work secures a blockchain by making block production cost computation and energy: miners compete to find a block hash below a target, and rewriting history means redoing that work.

  • Intermediate
  • 5 min read
  • Updated

Why it matters

Proof of work is the mechanism that made Bitcoin possible, and it remains the security model of the largest cryptocurrency. It is also the source of the two things most people have heard about mining: that it uses a great deal of electricity, and that it creates new coins. Both follow from one idea, that producing a block should be expensive and checking it should be cheap.

This page explains the general mechanism. Bitcoin’s implementation is covered in proof of work and mining.

How it works

The mining loop
  1. Build a blockCollect transactions and form a header.
  2. Hash itInclude a number called the nonce.
  3. Below the target?Almost always no. Change the nonce and repeat.
  4. Found oneBroadcast the block at once.
  5. Others verifyOne hash is enough to check it.
Finding a valid hash takes an enormous number of attempts. Checking one takes a single calculation.

Proof of work (PoW) is a way of deciding who may add the next block. Participants called miners compete to solve a puzzle that can only be solved by trial and error.

The puzzle uses a hash function. A miner assembles a candidate block and hashes its header. The network requires the result to be a number below a certain target. Because a hash is unpredictable, the only way to find a qualifying one is to keep changing a field in the header, called the nonce, and hash again, billions of times.

The first miner to find a valid hash broadcasts the block. Every node can confirm it with a single hash calculation. The winning miner receives newly issued coins and the fees from the transactions included.

In plain words

Imagine a lottery where each ticket costs a little electricity, and the winning ticket earns the right to write the next page of a shared ledger. Buying tickets is expensive. Checking whether a ticket has won takes a glance. Anyone wanting to rewrite an old page would have to win the lottery again for that page and for every page since.

Difficulty

Average attempts needed as the target tightens (simplified)
Hash must start with 4 zeros65,536
Hash must start with 5 zeros1,048,576

One more zero: 16 times the work.

Hash must start with 6 zeros16,777,216
Each hexadecimal character has 16 possible values, so each extra required zero multiplies the expected work by 16.

The lower the target, the fewer hashes qualify and the more attempts are needed. This is the difficulty. A simplified way to picture it is a required number of leading zeros in the hash.

Difficulty is not fixed. The protocol adjusts it so that blocks keep arriving at a planned pace however much computing power joins or leaves.

How difficulty keeps block times steady
  1. More miners joinTotal computing power rises.
  2. Blocks arrive fasterFaster than the intended pace.
  3. Difficulty risesThe target is lowered at the next adjustment.
  4. Pace restoredBlocks return to the intended interval.
The same loop runs in reverse when miners leave. Bitcoin adjusts every 2,016 blocks, aiming for about ten minutes per block.

The combined computing power of all miners is called the hash rate. A miner’s chance of finding the next block is its share of the total hash rate.

Why this secures the chain

Each block’s hash depends on the block before it. To alter an old transaction, an attacker would have to redo the proof of work for that block and for every block after it, and then overtake the honest chain, which keeps growing in the meantime. Nodes follow the chain with the most accumulated work, so the attacker needs to out-compute the rest of the network combined.

The cost of that is real: specialised hardware and electricity. Security under proof of work is therefore proportional to the resources honest miners spend. The wider principle is described in consensus.

Going deeper

Mining pools. A small miner might wait years to find a block. Miners therefore combine their computing power in pools and share the rewards in proportion to work contributed. Pools make income steadier, and they concentrate block production in a small number of coordinators.

Majority attacks. An actor with more than half of the hash rate could build a competing chain faster than everyone else and reverse recent transactions. On the largest network the cost of doing so is very high. Smaller proof-of-work chains have suffered such attacks, in some cases using rented computing power.

Energy use. Proof of work consumes electricity by design, because the cost is what makes rewriting history expensive. Critics point to the scale of the consumption and its environmental effects. Supporters reply that the expenditure buys security, and that miners seek out the cheapest power, which is sometimes surplus or renewable. Estimates of total consumption and of the energy mix vary considerably between sources. The alternative approach is proof of stake, compared directly in proof of work vs proof of stake.

Share of hash rate, share of blocksHypothetical illustration

Hypothetical numbers. A network aims for one block every 10 minutes, which is 6 per hour and 6 x 24 = 144 per day. A mining pool controls 10% of the total hash rate.

  • Expected blocks per day for the pool: 144 x 10% = 14.4.
  • This is an average. On a given day the pool might find 9 blocks or 20, because each attempt is independent.

Now suppose the total hash rate doubles while the pool’s own machines stay the same.

  • The pool’s share falls from 10% to 5%.
  • Until the next adjustment, blocks arrive about every 5 minutes. The pool still finds about 14.4 a day: 288 x 5%.
  • After difficulty adjusts, the pace returns to 144 a day and the pool’s expectation becomes 144 x 5% = 7.2.

The pool’s electricity cost has not changed. Its expected reward has halved.

What it does NOT mean

  • Miners do not solve useful mathematical problems. The puzzle is a deliberate guessing task whose only output is proof that work was done.
  • More mining power does not create more coins. Difficulty adjusts so that issuance follows the schedule.
  • More mining power does not make the network faster. Block times are held steady by the same adjustment.
  • A majority of hash rate is not control of the rules. Nodes still reject invalid blocks.
  • Proof of work is not secure in the abstract. A chain is only as hard to attack as the work protecting that particular chain.

Common misunderstandings

  1. Thinking mining is how transactions are verified. Every full node verifies. Mining decides who adds the next block.
  2. Treating all proof-of-work chains as equally safe. Total hash rate differs enormously between networks.
  3. Assuming the energy debate has a settled answer. Figures and conclusions differ between credible sources.

Risks and limits

  • Security depends on mining remaining economically worthwhile.
  • Hash rate and pool coordination can become concentrated.
  • Low-hash-rate chains are exposed to majority attacks.
  • Electricity use draws environmental and regulatory scrutiny, which differs by country.
  • Throughput is limited, and confirmation is probabilistic. See finality and throughput.

Key takeaway

Proof of work makes each block expensive to produce and trivial to check, so the history of the chain can only be rewritten by redoing the work behind it. The energy it consumes is the cost of that security, not a side effect.

Sources and further reading