Learn how Bitcoin mining works through interactive hash puzzles
A hash function is like a magic blender: you put in any text (a word, a sentence, a whole book) and it transforms it into a unique string of letters and numbers. The same input always gives the same output, but changing even one letter completely changes the result. And most importantly: you can't work backwards from the output to figure out the input!
A cryptographic hash function takes any input data and produces a fixed-size output (256 bits for SHA-256). It's deterministic (same input = same output), one-way (irreversible), and has the avalanche effect (tiny input change = completely different output).
SHA-256 is a cryptographic hash function that maps arbitrary-length input to a fixed 256-bit output. It's computationally infeasible to: (1) find the input from output (preimage resistance), (2) find two inputs with same output (collision resistance), (3) find second input with same output as first (second preimage resistance). Bitcoin uses SHA-256(SHA-256(data)) for mining.
Try typing anything below and watch how the hash changes:
Bitcoin miners compete to find a special number (called a "nonce") that, when combined with transaction data, creates a hash starting with a certain number of zeros. The more zeros required, the harder the puzzle! Miners have to try billions of different numbers until they find one that works.
Mining is a brute-force search for a nonce that produces a hash below the difficulty target. If the target requires 4 leading zeros (0000...), miners must test ~65,536 hashes on average. Real Bitcoin requires ~20 leading zeros, meaning miners globally test ~400 quintillion hashes per second.
The mining difficulty target is a 256-bit number. The network adjusts this every 2016 blocks (~2 weeks) to maintain 10-minute block times. Current difficulty ~60 trillion means finding a valid hash requires ~2^72 attempts on average. Total network hashrate ~400 EH/s provides thermodynamic security via unforgeable costliness.
Try to find a hash that starts with the required number of zeros:
Mining attempts will appear here...
Finding the right hash takes billions of guesses and lots of electricity. This makes it expensive to attack Bitcoin.
Computational work creates unforgeable costliness. Attackers must expend real energy to create fake votes, making Sybil attacks economically infeasible.
PoW converts energy into consensus. Attack cost scales linearly with honest hashrate, creating Nash equilibrium where honest mining is the dominant strategy.
Once a miner finds the winning number, anyone can check it instantly with just one hash calculation.
Asymmetric verification: Finding requires ~2^(difficulty) attempts, verifying requires exactly 1 hash. This allows lightweight nodes to validate blocks.
O(2^n) to find vs O(1) to verify. SPV clients can verify merkle proofs without downloading full blocks, enabling scalable verification.
Explore other aspects of Bitcoin's design: