Bitcoin uses SHA-256 applied twice (SHA-256d) as its proof-of-work hash function. A cryptographic hash function has three properties that matter here: it is deterministic (same input always gives the same output), it is effectively impossible to invert (you cannot work backwards from a desired output to find an input), and a tiny change in input produces an unpredictable, unrelated output (the avalanche effect).
A valid block's header hash, interpreted as a number, must be below a network-wide target value, lower targets mean fewer valid hashes exist among all possible ones, hence more attempts are needed on average. The header includes a 32-bit nonce field that miners increment; when that space is exhausted, miners also vary the coinbase transaction (via an 'extranonce') or the timestamp to get fresh header combinations to hash.
Because there is no shortcut, no pattern, no partial credit, no way to know you are 'close', finding a valid hash is a memoryless random process. This is precisely why a valid block is convincing evidence of real energy expenditure: the only known way to produce one is to perform, on average, a predictable and enormous number of hash computations.
Explain more simply
A hash function turns any input into a fixed-length, seemingly random string of characters. Change even one letter of the input and the output looks completely different, with no clue about what changed.
Bitcoin's puzzle asks miners to find a number, called a nonce, that makes the hash of the block header start with enough zeros. There is no formula for this, only trying billions of nonces per second until one works.
Real-world analogy
Finding a valid nonce is like shaking a jar of a trillion lottery balls and hoping the one that falls out has a number below a threshold, there is no way to shake smarter, only faster and more often.
Key facts
- Bitcoin's proof of work uses SHA-256 applied twice (SHA-256d).
- A valid block hash must be numerically below the current network target.
- There is no shortcut to finding a valid hash; miners must search by brute force.
Common misconception
“Miners are 'solving complex mathematical equations' that get progressively harder to compute.”
Each hash attempt is equally cheap and simple to compute; there is no equation being solved with growing complexity. Difficulty comes from needing an output below an ever-lower target, which requires more random attempts on average, not more complex ones.[1]
Go deeper
Hash rate is measured across the network in hashes per second (currently exahashes, 10^18, per second), and specialised ASIC hardware exists purely to compute SHA-256d as fast and efficiently as possible, since the algorithm itself cannot be improved, only the speed of brute-force search.
Double hashing (SHA-256 of SHA-256) was a defensive design choice against a length-extension property of the single SHA-256 construction, adding negligible cost while removing a class of theoretical attacks.
Quick check
Answer every question correctly (100%) to complete this lesson.
1.Which property of a hash function makes proof of work possible?
2.What happens when a miner exhausts the 32-bit nonce field without finding 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.
Quick check
Answer every question correctly (100%) to complete this lesson.
1.Which hash function does Bitcoin mining use (applied twice)?
2.What is a defining property of a cryptographic hash function like SHA-256?
3.What is the 'nonce' in a Bitcoin block header?
4.Why do miners also use an 'extranonce' in addition to the header nonce?
5.What does it mean for a valid block hash to be 'below the target'?
6.Is it possible to predict which nonce will produce a valid hash before trying it?
7.What is meant by 'hash rate' in mining?
8.If any single bit of transaction data in a block changes, what happens to the block's header hash?
Counts towards your streak in this browser.
Sources
- Bitcoin: A Peer-to-Peer Electronic Cash System (2008), Satoshi Nakamoto
The original nine-page proposal. Describes proof of work, timestamping and the incentive model.
- Bitcoin Core documentation, Bitcoin Core project
Reference implementation documentation, including validation and release notes.
