How does Bitcoin stop anyone from spending the same coin twice, with no bank in charge?
Digital money is just data, and data can be copied. Bitcoin's answer is a public ledger that is ruinously expensive to rewrite.
▶ Start the storyBy making everyone keep the same public record, and making that record ruinously expensive to rewrite. Double-spending means paying with the same money twice. Usually a bank or payment company prevents it by checking whether a coin has already been spent, but that makes it a single point of failure. Bitcoin removes the middleman: every computer in the network keeps its own copy of the ledger, the blockchain, and checks every payment against it.
The catch is that messages reach computers at slightly different times, so two payments of the same coin could each look valid to different parts of the network. Bitcoin settles which one counts by bundling payments into blocks, and making each block costly to produce. A miner must find a number that gives the block's hash, its digital fingerprint, a value below a target, which takes an enormous number of tries but only one check to verify. Each block also contains the fingerprint of the block before it, so the blocks form a chain.
When there is a disagreement, computers follow the longest chain, the one that took the most work. To undo a payment, a cheater would have to redo the work for that block and every block after it, and outpace everyone else. The odds of a slower attacker catching up shrink exponentially with every new block, which is why merchants wait for a few confirmations.

The guarantee has limits. Anyone with more than half the network's computing power could rewrite recent history, and smaller copycat currencies have lost millions this way.
Step 1: Sign and broadcast
You sign the payment with your private key; every node checks it.
Step 2: Bundle into a block
Miners collect payments and the previous block's hash.
Step 3: Prove the work
Find a nonce giving a hash below the target: many tries, one check.
Step 4: Follow the longest chain
Nodes accept the chain that took the most work.
Step 5: Wait for confirmations
Each block on top makes a rewrite exponentially less likely.
Quiz me
0/3
Recap
Longest chain wins, and every new block on top of your payment makes undoing it exponentially harder.
Surprising fact · Bitcoin's first block contains a newspaper headline about a second bank bailout.
Sources (5)
No source, no claim. Every fact in this lesson (30 claims) cites at least one of these.