{
  "docVersion": 1,
  "id": "blog-merkle-0001",
  "name": "Merkle trees — anti-entropy repair",
  "purpose": "Two replicas compare Merkle tree roots; on mismatch they descend only the differing branch, syncing gigabytes of data by exchanging kilobytes of hashes.",
  "nodes": {
    "rootA": {
      "type": "keyvalue",
      "label": "root = h(h01,h23)",
      "x": 190,
      "y": 30,
      "w": 190,
      "h": 80,
      "runtime": "9f3a…",
      "color": "purple"
    },
    "h01": {
      "type": "keyvalue",
      "label": "h01 = h(b0,b1)",
      "x": 40,
      "y": 200,
      "w": 170,
      "h": 78,
      "runtime": "4b21…"
    },
    "h23": {
      "type": "keyvalue",
      "label": "h23 = h(b2,b3)",
      "x": 360,
      "y": 200,
      "w": 170,
      "h": 78,
      "runtime": "e77c…"
    },
    "b0": {
      "type": "storage",
      "label": "block 0",
      "x": 0,
      "y": 370,
      "w": 120,
      "h": 82
    },
    "b1": {
      "type": "storage",
      "label": "block 1",
      "x": 140,
      "y": 370,
      "w": 120,
      "h": 82
    },
    "b2": {
      "type": "storage",
      "label": "block 2",
      "x": 320,
      "y": 370,
      "w": 120,
      "h": 82,
      "color": "red",
      "runtime": "≠ differs"
    },
    "b3": {
      "type": "storage",
      "label": "block 3",
      "x": 460,
      "y": 370,
      "w": 120,
      "h": 82
    },
    "rootB": {
      "type": "keyvalue",
      "label": "replica B root",
      "x": 750,
      "y": 30,
      "w": 190,
      "h": 80,
      "runtime": "8c1d… ≠",
      "color": "red"
    }
  },
  "edges": {
    "e1": {
      "from": "h01",
      "to": "rootA",
      "fromSide": "top",
      "toSide": "left"
    },
    "e2": {
      "from": "h23",
      "to": "rootA",
      "fromSide": "top",
      "toSide": "right"
    },
    "e3": {
      "from": "b0",
      "to": "h01",
      "fromSide": "top",
      "toSide": "left"
    },
    "e4": {
      "from": "b1",
      "to": "h01",
      "fromSide": "top",
      "toSide": "right"
    },
    "e5": {
      "from": "b2",
      "to": "h23",
      "fromSide": "top",
      "toSide": "left"
    },
    "e6": {
      "from": "b3",
      "to": "h23",
      "fromSide": "top",
      "toSide": "right"
    },
    "cmp": {
      "from": "rootA",
      "to": "rootB",
      "fromSide": "right",
      "toSide": "left",
      "label": "compare roots",
      "style": "dashed",
      "dir": "both",
      "color": "amber"
    }
  },
  "boxes": {
    "bA": {
      "x": -30,
      "y": -30,
      "w": 640,
      "h": 520,
      "label": "replica A — merkle tree over its key range",
      "color": "blue",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 700,
      "y": 180,
      "text": "roots differ → fetch A's two child\nhashes → only h23 differs → descend →\nonly block 2 is re-synced.\n\nO(log n) hash exchanges instead of\nre-shipping the whole range.",
      "color": "amber",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-12T09:00:00.000Z",
    "modifiedAt": "2026-07-12T09:00:00.000Z"
  }
}