Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 14 · From Scratch · Systems from scratch · about 13 min to read

Play it as a journeyTutor comes with a plan

A chain of your own

A Chain of Snapshots
A Chain of Snapshots · Open board

The Git board of snapshots, each one pointing at the one before. The chain you build here has the same shape. The new part is a price on adding each link, and a rule for when two chains disagree.

Before you start. A hash is a fixed-size fingerprint: change one byte and it changes completely (Git 02: The Tree hashed folders this way, and Git 03: Commits, Refs and HEAD let each Git commit name its parent by hash). A Merkle tree hashes hashes in pairs up to one top fingerprint (KV: everything used it to find three lost keys). Known nodes can agree on one log by majority (Raft Capstone: Everything).

Lesson 105 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The problem: a shared list of payments with nobody in charge
  • Hash chain: each block holds the fingerprint of the one before
  • Proof of work: a hash that must start with zeros
  • Why editing now costs work: redo every block after it
  • Fork: two valid chains that disagree
  • Fork choice: follow the chain with the most work
  • Why consensus without trust is expensive
  • The whole chain in one file
  • The fork choice, run
  • The catch-up table
  • Limits of this build
  • Where it is used

Terms it explains: block, hash chain, Merkle root, nonce, proof of work, fork, fork choice, HEAD, merge commit, parent, rebase, ref, snapshot.

Lab

Your teammate pulled your branch yesterday. You rebase it onto main today. How many of their commits are still on it?

Leave Copy my commits on top selected, raise Commits on my branch, and watch hashes rewritten climb.

Open The rebase copy

Review From Scratch