The short answer
A blockchain is a list of records where each entry carries a fingerprint of the entry before it. Change anything in an old entry and its fingerprint changes, which no longer matches what the next entry recorded, and that mismatch is visible to anyone who looks.
That is the entire idea. Everything else in this post is detail hanging off it.
Bitcoin's blockchain is that list, holding every transaction ever made, and every node keeps its own full copy rather than trusting somebody else's.
What a hash is
A hash function takes any input and produces a fixed-length output. Bitcoin uses SHA-256, which always returns 256 bits, written as 64 hexadecimal characters.
Two properties make it useful here:
- The output looks unrelated to the input. Change one character and the whole thing changes.
- It runs one way. Given an output, there is no method better than guessing to find an input that produces it.
Try it yourself
You do not need a website for this. On macOS or Linux, open a terminal:
printf 'Hello' | shasum -a 256
printf 'hello' | shasum -a 256
| Input | SHA-256 |
|---|---|
Hello | 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 |
hello | 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 |
One capital letter, and nothing about the second output resembles the first. There is no partial similarity to work from and no way to run it backwards. The rest of this post rests on that.
What is actually inside a block
A block is transaction data plus an 80-byte header. The header holds six fields, and three of them matter for this post:
- The previous block header's hash. This is the link. It is what makes the list a chain.
- The merkle root. All the transactions in the block get hashed together in pairs, over and over, until one hash is left. That single value stands for every transaction in the block, so altering any one of them changes it.
- The nonce. A number a miner is free to change, and the only reason it exists is covered below.
Hashing the header gives the block's own hash. The next block copies that value into its own header, and so on to the tip of the chain.
Why changing an old record breaks every record after it
Say a block from a year ago records that Alice paid Bob ten coins, and somebody wants it to say Alice paid Eve.
Editing the transaction changes the merkle root. A changed merkle root changes the header. A changed header changes the block's hash. And the block after it wrote down the old hash, so now it points at a block that no longer exists. Fixing that block changes its hash, and so on, every block from the alteration to the present.
This is not a rule anybody enforces by policy. It is what the arrangement does. Any node comparing the chain it holds with the altered one sees the break immediately, at the first block where the recorded hash and the actual hash stop matching.
Why redoing the work is not just a matter of time
Recomputing hashes is cheap. Recomputing valid hashes is not.
A block is only accepted if its header hash falls below a target set by the network's current difficulty. Since the hash cannot be steered, the only way to hit it is to change the nonce, hash again, and repeat, billions of times over. That is proof of work: the header, done properly, cost real electricity.
So the attacker has to redo the proof of work for every block from the one they altered onward, while the rest of the network keeps extending the honest chain. To catch up they need to produce blocks faster than everyone else combined, and sustain it. Nodes follow whichever valid chain has the most accumulated work, so anything short of that just produces a shorter chain nobody adopts.
What people get wrong
"The blockchain is immutable." It is not, and the word does more harm than good. The chain is expensive to change, and the cost rises with every block that gets built on top. That is a much better property than a promise, because you can price it. Blocks at the tip get reorganised occasionally, when two miners find a block at nearly the same moment and the network settles on one. That is normal operation, not an attack, and it is why one confirmation is worth less than six.
"Encryption keeps the blockchain safe." There is no encryption involved here. Hashing is not encryption: it has no key and cannot be reversed by anyone, including the person who computed it. The signatures on transactions use asymmetric cryptography, which is a separate mechanism doing a separate job.
"Once it is on the blockchain, it must be true." The chain records that a valid signature authorised a transfer. It says nothing about whether the person signing was entitled to, whether they were coerced, or whether the coins were stolen first. It is a record of what happened, not a judgement about it.
Where to go next
The next question this raises is who does that work and why they bother, which is Bitcoin miners. Then Bitcoin nodes, for the part of the system that checks all of it and refuses to be paid for doing so.
