Skip to content

Proof of work

9 min read

Mining is a guessing competition with an adjustable target. It converts electricity into an ordering of history that is expensive to fake.

Quiz still to takeGo to the quick check

Answer every question correctly (100%) to complete this lesson.

Your progress is kept in this browser. An account keeps it across your devices.

A hash function takes any input and returns a fixed-length fingerprint. Bitcoin uses SHA-256 twice over the block header. Change any bit of the input and the output changes unpredictably, so the only way to find a hash below the target is to try many inputs.

The nonce field exists to be varied. When it runs out, miners change other permitted fields, the timestamp, or the coinbase transaction, which changes the Merkle root, and keep going.

Every 2,016 blocks each node recomputes the difficulty from how long the previous 2,016 blocks actually took, steering the average interval back towards ten minutes. Nobody sets this centrally; every node computes the same answer from the same chain data.

Explain more simply

Miners repeatedly change one number in the block header and hash it, hoping the result starts with enough zeros.

There is no shortcut: you have to guess. Guessing costs electricity, and that cost is what protects the order of past transactions.

Real-world analogy

Rolling a die with billions of faces until you get a number below a line drawn by the network. The line moves so that, on average, someone wins every ten minutes.

Key facts

  • Difficulty retargets every 2,016 blocks.
  • Hashrate is an estimate derived from block times, never a directly observed value.
  • Mining does not 'solve maths problems' with useful external results; it performs deliberately wasteful guessing to make forgery costly.

Common misconception

A miner with the most hashrate can change Bitcoin's rules.

Hashrate decides which valid block gets built next. It cannot make an invalid block valid: nodes check every rule themselves and discard blocks that break them.[1]

Go deeper

The target is encoded compactly in the header's nBits field. Difficulty is defined relative to the genesis target, and the retarget is clamped to a factor of four in either direction to prevent violent swings.

Hashrate is never measured directly. Published hashrate figures are statistical estimates derived from observed block times and difficulty, which is why short-window estimates are noisy.

Quick check

Answer every question correctly (100%) to complete this lesson.

  1. 1.What is the difficulty adjustment for?

    What is the difficulty adjustment for?
  2. 2.Why must miners guess rather than calculate a valid hash?

    Why must miners guess rather than calculate a valid hash?

Counts towards your streak in this browser.

Extra exam questions

Every question here counts towards your accuracy, XP and rank. No guessing: every answer is explained.

16 questions

Quick check

Answer every question correctly (100%) to complete this lesson.

  1. 1.What is the purpose of proof-of-work in Bitcoin?

    What is the purpose of proof-of-work in Bitcoin?
  2. 2.What hash function does Bitcoin's proof-of-work use?

    What hash function does Bitcoin's proof-of-work use?
  3. 3.What is a 'nonce' used for in mining?

    What is a 'nonce' used for in mining?
  4. 4.What defines a 'valid' block hash in mining?

    What defines a 'valid' block hash in mining?
  5. 5.How often does Bitcoin adjust its mining difficulty?

    How often does Bitcoin adjust its mining difficulty?
  6. 6.What happens to difficulty if more mining power (hash rate) joins the network?

    What happens to difficulty if more mining power (hash rate) joins the network?
  7. 7.Why is proof-of-work described as 'easy to verify, hard to produce'?

    Why is proof-of-work described as 'easy to verify, hard to produce'?
  8. 8.What is the block subsidy reward that miners currently compete for (alongside fees)?

    What is the block subsidy reward that miners currently compete for (alongside fees)?

Counts towards your streak in this browser.

Sources