A Blockchain Primer › Module 2 › Lesson 2.6
Lesson 2.6: What Happens If You Change an Old Record? — Making History Tamper-Resistant
- #1. The Core Question
- #2. An Everyday Analogy
- #3. Core Concepts Explained
- #4. Diagrams
- #5. Key Takeaways
- #6. Quiz
The last lesson showed that changing an old record breaks everything after it, all along the hash references. This lesson goes one step further. How do we make rewriting the entire chain so expensive that tampering with history just isn't worth it?
1. The Core Question
If an attacker is willing to recompute every hash reference that comes after a change, can the structure from the last lesson still stop them? How does blockchain make rewriting history more than a hassle, so costly that people give up?
This lesson answers two questions: What actually makes a blockchain tamper-resistant? And why is tampering "too costly to be worth it" rather than "absolutely impossible"?
The short version: Changes get caught. Change anything and you have to rewrite every block after it, and each of those blocks means solving a hash puzzle all over again. The costs pile up until tampering is a bad deal.
2. An Everyday Analogy
Forging a Family History
Say you want to invent an aristocratic grandfather and slip yourself into a prominent family. Changing one entry in your own family tree isn't enough, because a real family's history ties into other families, schools, employers, and public records.
To make the fake grandfather look real, you'd have to forge birth certificates, school records, diplomas, a work history, and club records all at once. Matching references would also have to show up in other people's family trees. Changing one spot isn't enough. You'd have to change a whole web of history in which every piece backs up the others.
Blockchain uses a similar idea to make history hard to tamper with: it doesn't make any single piece of data unchangeable. It makes a single change force you to rewrite a long stretch of what comes after, at a heavy computational cost.
Every Page Needs a Fresh Stamp
Picture a ledger where every page needs a hard-to-get stamp before anyone accepts it. If you change a page in the middle, you don't just edit the words. You have to get a new stamp for every page after it. The earlier the change, the more pages need new stamps.
The hash puzzle is exactly that hard-to-get stamp.
3. Core Concepts Explained
3.1 The Three Layers of Tamper Resistance
Blockchain makes history hard to tamper with by stacking three layers.
Layer one: changes get exposed. Data is stored with hash references, so if you change the contents, the reference breaks. There's no way to quietly change a transaction without leaving a trace.
Layer two: changes have to be rewritten all the way to the head. Blockchain treats changes as all or nothing. From the point of change on, every affected block header has to be recomputed. The earlier the change, the bigger the rewrite.
Layer three: every block header requires solving a hash puzzle. Rewriting a block header isn't just tweaking a few numbers. You also have to find a new nonce that meets the difficulty requirement. Every block you rewrite costs fresh computing power.
You only get tamper resistance when all three layers work together.
3.2 What Data the Block Header Must Contain
For the hash puzzle to protect a block, the block header has to contain at least:
- The root hash of the transaction data structure.
- The hash reference to the previous block header.
- This block's hash puzzle difficulty.
- The time when work on the hash puzzle began.
- The nonce that solved the puzzle.
The difficulty itself is part of the block hash calculation. That way, an attacker can't quietly lower the difficulty to dodge the cost. Change the difficulty and the block hash changes too, so the puzzle still has to be solved again.
3.3 The Process of Creating a New Block
Creating a new block takes roughly seven steps:
- Get the root hash of the new transaction data structure.
- Get the hash reference to the previous block header.
- Get the difficulty currently required.
- Get the current time.
- Put these together into a draft block header.
- Solve the hash puzzle for this draft block header.
- Add the winning nonce to the block header to finish the new block.
The first steps are all quick. What really burns computing power is step six: changing the nonce over and over until the block header's hash meets the difficulty requirement.
3.4 Validation Rules
Before other nodes accept a block, they check:
- Whether it contains a valid hash reference to the previous block.
- Whether it contains a valid root hash of the transaction data structure.
- Whether the difficulty meets the requirement.
- Whether the timestamp is later than the previous block's.
- Whether it contains a nonce.
- Whether the hash calculated from all this data actually meets the difficulty requirement.
These rules make sure that only blocks that really solved the hash puzzle, and paid the computational cost, can be added to the chain. The timestamp rule also helps keep the blocks in order.
3.5 Why Tampering Gets Expensive
Say someone wants to change a transaction in the block 21 levels below the current head.
They'd have to:
- Rewrite the transaction data structure that holds that transaction.
- Rewrite the matching block header and solve that block's hash puzzle again.
- Keep going and rewrite the 20 block headers after it, solving each hash puzzle again.
If one hash puzzle takes 10 minutes on average, that's about 210 minutes in total. Meanwhile, honest nodes only have to solve one puzzle to add one new block, which takes about 10 minutes.
The times in this example are made-up assumptions for illustration. The point isn't the exact number of minutes. It's this: changing an old record means recomputing many blocks, while adding a new one the normal way means computing just one.
3.6 Difficulty Can't Be Set Arbitrarily
If the difficulty is too low, tampering is too cheap and history isn't safe enough.
If the difficulty is too high, even honest nodes burn too much computing power adding blocks. The system slows down, and eventually nobody wants to maintain it.
So real systems usually don't stick with one fixed difficulty forever. They adjust it based on how fast new blocks are being produced. They raise the difficulty when computing power grows and lower it when computing power drops, which keeps block production within a reasonable range.
3.7 "Tamper Resistance" Isn't Absolute Impossibility
Strictly speaking, blockchain's tamper resistance is economic:
- Changes get caught.
- Changes require rewriting every related block after them.
- Every block costs a fresh hash puzzle.
- Once the total cost gets high enough, the attacker decides it isn't worth it.
It isn't mathematically impossible to change. Someone with enough resources could, in theory, still rebuild a chain that's consistent with itself. The propagation, validation, and consensus mechanisms in Module 3 go on to decide whether other nodes accept that chain.
4. Diagrams
Figure 2-6-1: The Three Layers of Tamper Resistance
Figure 2-6-2: Changing an Old Record vs. Adding a New Block
5. Key Takeaways
- Tamper resistance doesn't mean data can never be changed. It means changes get caught and cost an enormous amount.
- The three layers: change-sensitive storage, rewriting the whole chain up to the head, and solving a fresh hash puzzle for every block header.
- The block header contains at least the root hash, the previous block reference, the difficulty, the start time, and the nonce.
- The difficulty is part of the block hash calculation, so nobody can quietly lower it to dodge the cost.
- Validation rules make sure only blocks that solved the hash puzzle can join the chain.
- Changing an old record means recomputing every related block from the point of change to the head. Adding a new block means computing just one.
- Difficulty needs to adjust over time. Too low is unsafe, and too high gets in the way of normal block production.
6. Quiz
Part 1: Single Choice (1–4)
Question 1
What's the most accurate way to understand blockchain's "tamper resistance"?
A. Nobody can ever change any data
B. Changes get caught, and the cost is usually too high to be worth it
C. Data can only be read, never written
D. Only a central institution can change it
Show answer
Answer: B
Explanation: Tamper resistance isn't absolute impossibility. Changes get caught, and rewriting costs a huge amount. A, C, and D are either too absolute or don't fit an open system.
Question 2
Why does the difficulty in the block header have to be part of the hash calculation?
A. To make the block header bigger
B. To keep attackers from quietly lowering the difficulty to dodge the computational cost
C. To increase the number of transactions
D. To make private keys more secure
Show answer
Answer: B
Explanation: Because the difficulty is part of the hash calculation, attackers can't quietly lower it to cut costs. Changing the difficulty also changes the block hash, so the puzzle still has to be solved again.
Question 3
Changing a transaction in the block 21 levels below the head usually requires:
A. Changing only that one transaction
B. Changing only that block header
C. Rewriting that block and the 20 block headers after it, solving each one's hash puzzle again
D. Changing only the nonce
Show answer
Answer: C
Explanation: Changing block 21 affects that block and the 20 block headers after it, and each one's hash puzzle has to be solved again.
Question 4
What problem does setting the difficulty too low cause?
A. Tampering gets cheaper, and history isn't safe enough
B. All transactions automatically become invalid
C. Private keys leak
D. Block headers disappear
Show answer
Answer: A
Explanation: Difficulty that's too low makes tampering cheaper and leaves history less safe. It doesn't invalidate transactions, leak private keys, or make block headers disappear.
Part 2: Multiple Choice (5–7)
Question 5
Which layers does tamper resistance depend on?
A. A data structure that's sensitive to change
B. Rewriting everything up to the head after any change
C. Solving a hash puzzle for every block header
D. Every node staying online forever
Show answer
Answer: A, B, C
Explanation: Tamper resistance depends on the change-sensitive structure, rewriting the whole chain, and the cost of hash puzzles. Whether nodes are online isn't part of the definition.
Question 6
What data does a block header usually contain?
A. The root hash of the transaction data structure
B. The hash reference to the previous block header
C. The difficulty, start time, and nonce
D. The complete original text of every transaction
Show answer
Answer: A, B, C
Explanation: The block header stores the root hash, the parent block reference, the difficulty, the time, and the nonce. The complete transaction text lives in the transaction data structure.
Question 7
Which statements about adjusting difficulty are correct?
A. Difficulty that's too low makes tampering cheaper
B. Difficulty that's too high slows down block production by honest nodes
C. Real systems may adjust difficulty based on how fast blocks are produced
D. Once the difficulty is set, it can never change
Show answer
Answer: A, B, C
Explanation: Difficulty that's too low is unsafe, and difficulty that's too high gets in the way of block production, so real systems often adjust it over time. D is wrong because difficulty can be adjusted.
Part 3: True or False (8–9)
Question 8
True or false: if you change the transaction and update the hash reference that points directly to it, you don't need to rewrite the blocks after it.
Show answer
Answer: False
Explanation: Even if you update the direct reference, the root hash above it, the block header hash, and the parent references after it still change, so you have to keep rewriting the blocks that follow.
Question 9
True or false: blockchain's tamper resistance means "extremely high cost" in the economic sense, not that changes are mathematically impossible.
Show answer
Answer: True
Explanation: Blockchain makes tampering so expensive that it's usually not worth it, but changes aren't mathematically impossible.
Part 4: Scenario Analysis (10)
Question 10
A chain currently has 31 blocks below its head. An attacker wants to change a transaction in block 10. Assume each block's hash puzzle takes 8 minutes on average.
Answer the following:
- How many block headers have to be rewritten?
- Roughly how much hash puzzle computing time does that take?
- Why do we say "the earlier the change, the higher the cost"?
Show answer
Answer:
- From block 10 to the head, 31 - 10 + 1 = 22 block headers have to be rewritten.
- 22 × 8 = 176 minutes, or about 2 hours and 56 minutes. This is an estimate for illustration. The actual time depends on the difficulty and the computing power.
- The earlier the change, the more blocks after it are affected, the more hash puzzles have to be solved again, and the higher the total cost.