21 BTC

Proof of work

Updated Reviewed articleRandom article
In plain words

Proof of work is how Bitcoin decides who adds the next block: miners spend electricity on guessing, and a correct guess is easy for everyone to check but expensive to produce.

How it works

A miner hashes the block header with SHA-256 twice. The result must be a number below the current target. Hashes look random, so the only way to find one is to keep changing the nonce (and other fields) and try again. On average the network needs about difficulty × 2³² attempts per block.

Checking the answer takes one hash, so every node can verify the work instantly. The chain with the most accumulated work is the valid one.

Origin

The idea comes from Hashcash, Adam Back's 1997 anti-spam scheme, which the whitepaper cites. Bitcoin made the work a lottery for the right to write the next block and paid the winner in new coins.

Energy

The electricity is the security: rewriting history would need more energy than the honest network spends. Whether that use is worth it is debated; the Orange pill page lists the main arguments with sources.

Hashrate and difficulty live The energy question Watch: But how does bitcoin actually work? (3Blue1Brown) (2017)

See also

References

  1. Satoshi Nakamoto, Bitcoin: A Peer-to-Peer Electronic Cash System (2008) bitcoin.org
  2. Bitcoin Wiki: Proof of work en.bitcoin.it
  3. Adam Back, Hashcash: A Denial of Service Counter-Measure (2002) hashcash.org