A puzzle with no shortcut
Bitcoin mining is a brute-force search for a number — the nonce — such that hashing the block's contents together with that nonce through SHA-256 produces an output below a target threshold. SHA-256 is a cryptographic hash function: deterministic (same input always gives the same output), but with no known way to predict or reverse-engineer which inputs produce which outputs. The only known way to find a nonce that works is to try candidates one at a time and check.
SHA256( SHA256( block_header || nonce ) ) < target
block_header = previous block hash, Merkle root of transactions, timestamp, difficulty bits, nonce
target = a 256-bit number; smaller target = harder puzzle
(equivalently: hash must start with enough leading zero bits)
Why difficulty, not effort, is what's tuned
Because SHA-256's output is, for this purpose, indistinguishable from a uniformly random 256-bit number for each nonce tried, finding a hash below a given target is a Bernoulli trial repeated over and over: each attempt has a fixed, tiny probability p of success equal to target/2²⁵⁶, and attempts are independent, so the number of tries needed follows a geometric distribution. The expected number of hash attempts to find a valid nonce is exactly 1/p — there is no way to search smarter, only faster (more attempts per second) or in parallel across many machines, which is exactly why mining hardware evolved from CPUs to GPUs to purpose-built ASICs chasing pure hash-rate.
The 10-minute target and automatic difficulty adjustment
Bitcoin's protocol targets a new block roughly every 10 minutes, regardless of how much total hashing power (the network hashrate) is pointed at the network at any given time. It achieves this with a self-correcting feedback loop: every 2016 blocks (about two weeks at the 10-minute target), the network recalculates the difficulty target based on how long the previous 2016 blocks actually took to find.
new_target = old_target × (actual_time_for_2016_blocks / expected_time_of_20160_min) hashrate rises → blocks found faster than 10 min → target shrinks → puzzle gets harder hashrate falls → blocks found slower than 10 min → target grows → puzzle gets easier
This is a direct negative feedback loop on the expected-attempts formula above: since expected attempts scale as 1/target, shrinking the target directly increases the expected work per block by exactly the factor needed to counteract however much faster the network's aggregate hashrate has grown, holding the average block time close to 10 minutes whether the network has ten computers or ten million pointed at it.
Why proof-of-work secures the chain
The security argument is entirely about cost, not secrecy. Each block's header includes the previous block's hash, so altering any past block would change its hash, breaking the chain link to every block after it — the attacker would then have to redo the proof-of-work for that block and every subsequent block, racing to outpace the entire honest network's ongoing hashrate before their alternative chain is even accepted (Bitcoin's rule is to follow whichever valid chain represents the most cumulative proof-of-work). For the current Bitcoin network, redoing even a modest number of blocks' worth of hashing faster than the rest of the world's combined mining hardware is economically and physically prohibitive — the security doesn't come from the puzzle being unsolvable, only from it being so expensive to solve at the required rate that honest mining is always the more profitable strategy.
What the animation is actually showing
The nonce search this simulation animates is exactly the brute-force loop described above: try a nonce, hash it, check against the target, increment, repeat — millions or billions of times per second on real mining hardware, visualised here at a comprehensible speed. The difficulty auto-adjustment shown alongside it is the same 2016-block recalculation the real network performs, scaled down so you can watch the target tighten or loosen as the simulated hashrate changes, keeping the average time between blocks anchored near 10 minutes no matter how fast or slow the mining actually is.
Frequently asked questions
Why can't a faster computer just guess the right nonce directly?
Because SHA-256 is a cryptographic hash function with no known shortcut: its output for any given input is, for practical purposes, unpredictable and uniformly random-looking. The only way to find a nonce that produces a hash below the target is exhaustive trial and error — more hashing power only lets you try more candidates per second, not guess more cleverly.
Why does Bitcoin adjust its mining difficulty?
To keep the average time between blocks close to 10 minutes even as the total computing power pointed at the network changes over time. Every 2016 blocks, the protocol compares how long that batch actually took against the 2-week target and rescales the difficulty target proportionally — harder if blocks came too fast, easier if they came too slow.
What actually makes the blockchain secure against tampering?
Cost, not secrecy. Each block links to the previous one via its hash, so altering an old block breaks every hash after it, forcing an attacker to redo the proof-of-work for that block and all subsequent ones fast enough to overtake the honest network's combined hashrate. For any real network hashrate, that's economically prohibitive, which is the entire security guarantee — not that the puzzle can't be solved, but that solving it fraudulently faster than everyone else combined is not feasible.
Try it live
Everything above runs in your browser — open Bitcoin Mining and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Bitcoin Mining simulation