learn-blockchain-with-phoebe / Practitioner session 10 of 10
Learn Blockchain with Phoebe · Practitioner session 10 of 10

The chain bench

Nine sessions built the mechanism a piece at a time. This one puts the whole register in front of you with the buttons an attacker would want. Edit an entry and watch the check fire. Recompute that block's hash to cover your tracks and watch the failure move rather than vanish. Then reforge the tail and see what it cost, which at difficulty zero is nothing at all. That last result is the uncomfortable one, and it is the reason every other part of the design exists.

🔴 Hardest Anyone who will build or audit one Anyone who has to answer for its guarantees 45 min
0-3 · Welcome 3-18 · Build and break 18-34 · Price the rewrite 34-45 · What it proves, and close
Part 0

Where this lands

Session 1 hashed things. Session 2 assembled the register. Sessions 3 to 5 broke it, priced a block and priced a rewrite. Session 6 proved membership without sending the set. Sessions 7 to 9 covered who may write, how many machines agree, and what a contract on a chain does and does not promise. Everything below runs from the same assets/chain-live.js that every other session used, and the hash inside it passes the three published SHA-256 test vectors.

Live = worked through in the 45 minutes Self-study = the full depth, after class 🔍 Every diagram zooms

★ What you walk out with today. The two stage attack performed with your own hands, so the difference between a hash mismatch and a link mismatch is something you have seen rather than been told. A measured answer to what a rewrite costs, and the honest version of that answer at difficulty zero. And four questions worth asking anyone who tells you a chain has made their data trustworthy.

LiveWhat the bench is doing4 min▶

Each button runs the real engine. Building assembles six blocks, each one hashing its own index, timestamp, entry, the previous block's hash and its nonce. Editing changes an entry and leaves every stored hash alone. Recomputing fixes just that block's hash. Reforging re-mines from block 2 to the end.

Nothing is stored between presses. The digests in the table are computed when you press, which is why raising the difficulty makes the build visibly slower: the machine is guessing.

Part 1 · the bench

Build it, then break it

15 min hands on

Work the four buttons left to right, and read the check line after every press before moving on. The sequence matters more than any single result.

LiveThe sequence worth doing first5 min▶
  • Build at difficulty 0. Six blocks, no problems. Note that block 0's previous hash is a row of zeros, which is a convention and not a computed value.
  • Edit block 2. One problem: a hash mismatch at block 2. The entry changed and the stored hash did not, so recomputing no longer agrees.
  • Recompute its hash. Still one problem, and this is the moment the course turns on: it is now a link mismatch at block 3. The failure did not go away, it moved.
  • Reforge from block 2. Clean. At difficulty 0 that took no measurable work, and the register now tells a different story with no trace of the edit.
LiveWhy the two failure kinds are worth telling apart3 min▶

A hash mismatch at block N means the record at N was edited in place by somebody who did not recompute anything. A link mismatch at block N means block N-1 was rebuilt and its successors were not. They point at different levels of effort and different amounts of knowledge, which makes the distinction genuinely useful when you are looking at a register that has failed rather than reading about one.

Self-studyRun the same edit at difficulty 34 min▶

Repeat the four steps with the difficulty set to 3 and watch the hash count on the reforge. Then do it again. The two totals will differ, often by a lot, because four blocks means four independent lottery draws rather than four times an average.

That variability is the honest shape of the cost. A single reforge total is one draw, and quoting it as "what it costs" is the mistake session 4 spends its whole page on.

Part 2 · what the bench proves

And what it does not

8 min live

The bench demonstrates one guarantee cleanly and is silent on several others. Being precise about which is which is the difference between understanding the technology and repeating its marketing.

One guarantee, stated narrowly, and four things it is not What the bench demonstrates An entry has not changed since it was written A change is localised: the check names the block and the kind, hash or link Hiding a change means redoing every later block At difficulty 0 that costs nothing, which is why mining exists at all What it is silent about Whether the entry was true when it was written Who wrote it, which is a signature question settled outside the register Whether other machines hold the same history Whether one party could outpace all the others, which nothing measured here bounds The left column is a real guarantee and a narrow one. Most overclaiming about chains consists of quietly moving an item from the right column to the left.
🔍 Click to zoom - the useful skill is noticing which column a claim belongs in.
LiveThe difficulty zero result is the important one4 min▶

A register with no mining is fully rewritable in milliseconds by anyone who can edit the file. Every hash still chains, every check still passes, and the history is whatever the last editor wanted. Tamper evidence on its own buys you nothing against someone who can write to the store.

What mining adds is not a different guarantee, it is a price. The structure was always rewritable and the work is what makes rewriting unattractive. Saying "it is on a chain, so it cannot be changed" skips the only part that was doing the work.

Self-studyFour questions for a system you are shown4 min▶
  • What exactly is on the chain? Often it is a hash of a document held elsewhere, which protects the document from silent edits and protects nothing else.
  • Who runs the machines? If the answer is one organisation, the tamper evidence is against outsiders and not against the operator.
  • What is the work factor, and who could exceed it? A price only deters people for whom it is a price.
  • What happens when an entry is wrong? If the answer is that it cannot be, the person answering has not run session 5.
Part 3 · build-along

Work the bench, then write the paragraph

11 min hands on

Six steps on the bench above, ending in one paragraph you could send to somebody deciding whether to fund a register.

Run the four button sequence at difficulty 0

Build, edit, recompute, reforge. Write down the check line after each press, in four short lines. You should have: clean, hash at 2, link at 3, clean.

Say what changed between press two and press three

Nothing about the attacker's goal changed and nothing about the entry changed. Only the failure moved. Say in one sentence what that tells you about where the protection actually lives.

Reforge twice at difficulty 3

Note both hash totals. Then say which of the two you would quote to somebody, and why the honest answer is neither on its own.

Put a claim in the right column

Take the sentence "our records are on a blockchain so they cannot be tampered with" and rewrite it so that every part of it sits in the left column of the diagram above. Notice how much shorter it becomes.

Find the step nobody can verify

Trace the Harbourgate entry that says the seal was intact, back to the moment it became true. Identify the point in that path where the register has nothing to offer, and say who is trusted there.

Write the paragraph

What the register would guarantee, what it would not, what it would cost to defeat, and who would still have to be trusted. Four sentences. If the fourth is empty you have missed somebody.

The habit to keep. Whenever somebody says a record is protected, ask against whom. Tamper evidence protects against a party who can edit the store but cannot redo the work. It does nothing against a party who can do both, and nothing at all against a record that was wrong when it was written.

Check yourself

Three questions

You edit block 2, then recompute block 2's hash. The check still reports exactly one problem. What changed?

Fixing the hash makes block 2 internally consistent and pushes the inconsistency into its successor. The failure moves rather than disappearing, which is why hiding an edit means redoing every later block.

At difficulty 0 you reforge the tail and the register verifies clean with the edited entry in place. What does that establish?

The chain was always rewritable. Mining adds a price rather than a different guarantee, which is why "it is on a chain so it cannot change" skips the part doing the work.

A supplier says their register proves every inspection really happened. Which column does that claim belong in?

No amount of work factor makes an entry true. Whether the inspection happened is settled by the inspector, and the register faithfully preserves whatever they wrote.

After the course

Homework

An hour, on something real.

Build the smallest chain that works

A hash, a previous hash, and a verify loop that recomputes both. Forty lines is plenty, and writing it yourself is what makes the two failure kinds obvious rather than memorised.

Break it before you trust it

Edit a record and confirm your verify reports it. A check you have never seen fail is not yet a check, and that applies to every validator you will ever inherit.

Take one real claim apart

Find a product page that says a chain makes data trustworthy, and sort each sentence into the two columns. Write down which of the four questions it does not answer.

Covered today

What this session covers

✓The two stage attack, performedHash mismatch at block 2, then a link mismatch at block 3.
✓Reading the check as forensicsThe kind of failure says what the attacker did and how much they knew.
✓Reforging, and the difficulty zero resultThe structure alone is rewritable; work is what makes it unattractive.
✓One guarantee, stated narrowlyAnd the four things the register is silent about.
✓Four questions for a system you are shownWhat is on it, who runs it, what the work factor is, and what happens when an entry is wrong.
◐An attacker with more capacity than everyone elseNamed in session 8; nothing measured here bounds it.
◐Who may write, and key managementSession 7, and the security courses beyond it.
○Any cryptocurrency, price, market or walletNot here. Harbourgate keeps a custody register, and nothing on this page is investment advice.
Take this with you

Cheat sheet

Hash mismatch at N. The record at N was edited in place.
Link mismatch at N. Block N-1 was rebuilt and its successors were not.
Fixing a hash moves the failure. It does not remove it.
Difficulty 0 is fully rewritable. The work, not the structure, is the deterrent.
Quote a mean with its trial count. One reforge total is one lottery draw.
Ask against whom. Tamper evidence is relative to what the other party can do.
A chain preserves, it does not adjudicate. A false entry is kept faithfully forever.
Four questions. What is on it, who runs it, what it costs to beat, what happens when an entry is wrong.