A lottery you win by working
Imagine thousands of strangers around the world, none of them in charge, all wanting to write the next page of a shared ledger. If they all just wrote at once, you would get chaos — competing pages, no agreement. Proof of work solves this with a beautifully simple idea: don't vote, work. To earn the right to add the next block, you must first win a lottery — but the only way to buy lottery tickets is to burn real computing effort. Whoever pays that effort and gets lucky first wins, and everyone else can check the win in an instant.
The people running this race are called miners, and the race itself is mining. Calling it "mining" is a metaphor: like digging for gold, you spend effort with no guarantee of reward, and now and then you strike it. Let's see exactly what they are digging for.
The puzzle: hash below a target
The puzzle uses a cryptographic hash — a function that takes any data and returns a fixed-length scrambled number. Two things make it perfect for a lottery. First, you cannot predict the output: change the input by one character and the result jumps to a completely different, random-looking number. Second, you cannot run it backwards: there is no shortcut to find an input that gives a number you want. The only way is to guess, hash, check, repeat.
To build a block, a miner gathers the pending transactions and a small header summarizing the block. The header includes one field a miner is free to change at will: the nonce, short for "number used once." The miner's job is to find a nonce so that hashing the whole header gives a number small enough — specifically, below a threshold called the target. Stated as one tidy inequality, the winning condition is simply:
hash( block_header_with_nonce ) < target nonce = 0 -> hash = 9c4f...e1 (too big, no) nonce = 1 -> hash = 71a0...3d (too big, no) nonce = 2 -> hash = a8b2...ff (too big, no) ... nonce = 49281-> hash = 0000a3...7 (below target -> WIN!)
Hard to find, instant to check
Here is the magic that makes the whole system work. Finding a winning nonce is enormously hard — there is no clever method, only blind trial, so a miner may compute trillions of hashes before one lands below the target. But once found, anyone can check it in a single hash: take the header, the lucky nonce, run the hash once, and see for yourself that the result is below the target. Costly to produce, trivial to verify — that asymmetry is the heart of proof of work.
This is why nobody needs to trust anybody. A winning block carries its own proof: the nonce is evidence that someone really burned the computing effort. You don't believe the miner because they are nice or official — you believe them because you can re-run one hash and the math checks out.
Difficulty keeps the clock steady
If the target were fixed, the race would speed up as more miners joined or bought faster machines — blocks would arrive too quickly and unpredictably. So the network adjusts the target on a schedule, a mechanism called mining difficulty. The rule is self-correcting: if recent blocks came too fast, the network lowers the target (raises difficulty), demanding more leading zeros; if blocks came too slow, it raises the target (lowers difficulty).
The longest chain wins
Two miners sometimes win at almost the same moment, and the network briefly splits into two competing chains. There is no judge to settle it. Instead the rule is mechanical and famous: honest miners always build on the chain with the most accumulated work — in practice, the longest valid chain. Whichever branch the next block lands on pulls ahead, and the shorter branch is simply abandoned. Its transactions return to the waiting pool to be included later.
This is why all that effort buys security. To rewrite an old block, an attacker would have to redo its work and out-race every honest miner building on the real chain — re-winning lottery after lottery faster than the rest of the world combined. The deeper a block is buried, the more impossibly expensive that becomes, which is exactly why an old block is treated as settled.
All this guessing runs on electricity, and that energy use is real — it is the literal cost that makes the chain expensive to attack. With proof of work clear, the next guide looks at the other great engine of agreement, which replaces burned electricity with locked-up stake.