A Node Whose State You Can Explain

Deliverable: admit transactions, mine blocks, validate branches, publish a consistent winning tip and UTXO map. This is an in-memory teaching model.

1 / 6

Integrate contracts explicitly

Fixed ffffffff input sequence; raw double hashes; course PoW conventions. Sign serialization with all input scripts empty, then input index and locking script. Mempool admits spends of confirmed outputs; children require a later version.

2 / 6

Reconcile the ledger

Genesis has 50. T pays 43 + 5; fee is 2. Subsidy is 10. A1 adds coinbase 12, so live total becomes 60. Empty A2 raises it to 70. Mined coinbase LockTime commits height, giving each reward a distinct identity. Reject duplicate IDs, live-output collisions, excess rewards, and arithmetic overflow.

3 / 6

Validate privately, publish once

Use the candidate parent's branch state. Apply ordinary transactions before crediting coinbase. A same-block reward cannot finance its own justification. A known header still requires a matching supplied body. A failed block changes no indexed or active state.

4 / 6

Budget and branch trace

10/62 exceeds 11/160; integer division loses this fact. 21-byte coinbase + 62-byte spend fits an 83-byte transaction budget.

At G→A1→A2, validate B1 against G. B2 ties: retain A2. B3 wins: publish B3's state and prune invalid mempool candidates. Replay is a correct baseline; using undo records efficiently is a later optimization.

5 / 6

Review the artifact

Can you account for every live outpoint and every unit of value? Test consecutive empty blocks, exact fit, altered known bodies, excess rewards, competing branches, and invalid longer candidates. Explain a failing trace without reopening the lesson before calling the capstone understood.

6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen