Generalizing the Ledger into a World Computer
The previous page left us with a machine that works because of what it refuses to do. Bitcoin’s transition function is a small, fixed menu — mostly “move value from these inputs to those outputs, if the spending conditions check out.” That menu is deliberately short so every stranger’s node can verify every transaction cheaply and provably. The limits are a feature.
But a short menu is still a menu. Every new thing you might want the ledger to do — a name registry, an escrow, a vote, a savings contract — has to be added as another item, argued over, and soft-forked in one at a time. This page is about the 2013 idea that stepped around that entire treadmill: instead of enlarging the menu, let the transition function run arbitrary programs. The ledger stops being a value-transfer system with features and becomes a general-purpose computer — one machine every node runs, whose state anyone can extend with code. That reframing is the whole reason Ethereum exists, and everything after it in this book is a consequence.
From “a fixed menu” to “run any program”
Section titled “From “a fixed menu” to “run any program””Recall the shape of a ledger as a state machine: there is a state (who owns what) and a transition function that takes the current state plus a transaction and produces the next state. Untrusting strangers agree on the world because they all run the same transition function over the same ordered transactions and land on the same state.
Bitcoin’s transition function is essentially one operation with parameters:
Bitcoin's transition function (simplified) ──────────────────────────────────────────── apply(state, tx): for each input: check the spending script unlocks a real, unspent output move the value: destroy the spent outputs, create the new ones → next state (a new set of unspent outputs)Every wanted capability has to be squeezed into that spend-check or added as a new, special-cased rule. The 2013 Ethereum whitepaper’s move was to generalize the last line of that function. Instead of a fixed value-transfer, let a transaction carry — or call — a program, and let the transition function be “execute that program against the shared state”:
Ethereum's transition function (idea) ──────────────────────────────────────────── apply(state, tx): find the code the tx targets (deployed program, or a plain transfer) RUN that code against the shared state → next state (whatever the code left behind: balances, storage, new code)Same skeleton — state, transition, agreement by re-execution — but the last step is now arbitrary computation rather than one hard-coded action. You do not add a “voting transaction type” to the protocol; you write a voting program once and deploy it. The protocol never has to learn about voting, tokens, or auctions. It only has to know how to run code and charge for it.
The world-computer mental model
Section titled “The world-computer mental model”Here is the mental model to carry for the rest of the book. Picture one computer — not a metaphor, a literal (if unusual) machine — with:
- State: a giant map from account address → what that account holds. For a person, that is a balance and a transaction count. For a program, it is also its code and its own private storage (a key→value map the code can read and rewrite).
- A processor: a virtual machine that executes program bytecode. (We build a tiny one later in Build Your Own EVM.)
- Inputs: transactions, ordered into blocks, each one a call that runs some code and mutates state.
THE WORLD COMPUTER ┌───────────────────────────────────────────────┐ │ STATE: address ─► { balance, nonce, │ │ code?, storage? } │ │ │ │ a transaction calls code ─► the VM runs it │ │ ─► state changes ─► everyone recomputes it │ └───────────────────────────────────────────────┘ ▲ ▲ ▲ ▲ node node node node (a full replica of the whole machine, everywhere)The twist that makes it a world computer rather than just a computer: it is replicated on every node. There is not one physical machine in a data center. There are thousands of identical copies, each independently running the same programs over the same inputs and checking that they agree. The “computer” is the consensus about what all those copies compute — the same convergence requirement that has driven this book from page one, now applied to arbitrary code instead of just balances.
Anyone can extend this machine. Deploying a program is just a transaction that installs new code at a
fresh address. From that moment, the program is part of the shared machine — callable by anyone,
running identically on every node, its storage as much a part of the world state as anyone’s balance.
No one owns it; everyone shares it
Section titled “No one owns it; everyone shares it”The most counterintuitive property falls straight out of replication: there is no operator.
- No off switch. No server to unplug, because the machine is every node at once. To stop it you would have to stop thousands of independently run copies worldwide, simultaneously.
- No privileged account. No root user, no admin who can freeze a balance or edit someone’s storage. The transition function is the only authority, and it treats every account by the same rules. A deployed program runs the same for its author as for a stranger.
- No gatekeeper. You do not ask permission to deploy code or call a contract. You submit a valid, paid transaction and the network processes it like any other.
These are not policies someone chose to be generous; they are structural consequences of no single copy being authoritative. Availability and neutrality come from the replication, not from a promise. If one node censors you, the other thousands do not — so the machine as a whole does not. This is what people mean by credible neutrality: the computer will run your correct, paid-for program regardless of who you are, because no part of it has the power to decide otherwise.
The flip side, which the rest of the book keeps paying for: because everyone shares the machine, your computation is everyone’s burden. Every node runs your program and stores your program’s state, forever. A machine no one owns is a machine everyone maintains — and that maintenance has to be paid for. Hold that thought; it is the last section.
Contrast with Bitcoin: value transfer vs. programs that evolve
Section titled “Contrast with Bitcoin: value transfer vs. programs that evolve”The sharpest way to see the generalization is to line the two transition functions up on what they let state do.
BITCOIN ETHEREUM ─────── ──────── state = set of unspent outputs state = map of accounts (some with code) tx = spend outputs, make new tx = run code against the state scripts: verify a spend, then programs: read state, compute, write they're done state that PERSISTS to next time memory: none between txs memory: contract storage survives calls result: value moved result: whatever the code decidedBitcoin Script can encode rich spending conditions — multisig, timelocks, hashlocks — but a script
answers one question (“may this output be spent?”) and then it is over. It has no memory that carries
to the next transaction. Ethereum’s programs remember and evolve: a token whose balances live in a
contract’s storage, an auction that tracks the current high bid across many bids, a counter that goes up
by one every time it is called. That last one is the smallest program that shows the difference — it is
the companion crate’s counter_code:
// ethmini/src/contracts.rs — the whole point of a contract in seven opcodes:// persistent state that survives between calls and lives in the chain,// not in any one process.pub fn counter_code() -> Vec<u8> { assemble(&[ Op::Push(COUNTER_SLOT), // key: storage slot 0 Op::SLoad, // load the current count from CHAIN storage Op::Push(1), Op::Add, // count + 1 Op::Push(COUNTER_SLOT), Op::SStore, // write it back — persists to the next call Op::Stop, ])}SLoad and SStore are the two opcodes Bitcoin has no equivalent of: they read and write a program’s
own slice of the shared world state. That is the entire leap. Bitcoin transitions move value between
outputs; Ethereum transitions run programs that carry memory forward. Once state can hold code and code
can hold state, the ledger is a general-purpose computer.
Under the hood — where a program’s memory lives
Section titled “Under the hood — where a program’s memory lives”When counter_code runs SStore, where does the 1 actually go? Not into the transaction, and not
into any node’s RAM. It goes into the storage of the contract account, which is part of the world
state that every node holds and hashes into the state root. The next time
anyone calls the counter — a different person, a different day, a different node processing it — SLoad
reads back exactly the value the last call left, because they are reading the same replicated state.
This is why “smart contract” is really just “a program whose variables live in the ledger.” The persistence that feels magical is nothing more than the transition function committing the program’s storage writes into the shared state, the same way it commits a balance change. The machine does not distinguish “your balance went up” from “this contract’s counter went up” — both are edits to the one map that is the world’s state.
The immediate consequence: arbitrary programs can loop forever
Section titled “The immediate consequence: arbitrary programs can loop forever”We have quietly created a problem, and it is the one the next page exists to solve. If the transition function runs arbitrary programs, then it runs programs that contain loops — and a loop can be written to never terminate:
loop: do nothing goto loop // runs forever, on every node, at onceOn Bitcoin this can’t happen: Script forbids loops precisely so that every script provably halts and no node can be made to hang. Ethereum threw that guard away to gain programmability. So what stops a contract that loops forever from freezing every node on Earth simultaneously — a free, global denial-of-service?
You might hope to screen out non-terminating programs before running them: inspect the code, reject anything that might loop forever. You can’t — and this is not a matter of writing a cleverer checker. The halting problem (Turing, 1936) proves that no algorithm can decide, for every possible program, whether it will eventually halt or run forever. There is no test that reliably separates “this halts” from “this loops.” So a machine that agrees to run any program cannot promise, in advance, that the program stops.
If you can’t screen it out, you’re left with one honest option: let it run, but make running cost something, and cap how much it may cost. Don’t ask “will this halt?” — ask “how much is this allowed to consume before we stop it ourselves?” That is the reframing the next page is built on. Every step a program takes will be charged a fee, paid in the network’s native asset, and a transaction carries a budget; when the budget runs out, the machine halts the program whether it was finished or not.
That native asset — the thing you spend to make the world computer run your code — is ether, and it is the subject of the next page: Ether as Fuel.
The architect’s lens
Section titled “The architect’s lens”- Why does it exist? Because adding capabilities to a ledger one transaction-type-at-a-time doesn’t scale — every new use case would need a protocol change agreed by everyone. Generalizing the transition function to run arbitrary code lets applications be deployed, not forked in.
- What problem does it solve? It turns “we need the protocol to support X” into “someone writes a program for X and deploys it,” so the base layer stays small and stable while the space of applications grows without permission.
- What are the trade-offs? Expressiveness costs verifiability. Every node must now run untrusted, possibly-looping code and store its state forever — heavier than Bitcoin’s fixed, provably-halting scripts — which is exactly why it needs a metering system Bitcoin doesn’t.
- When should I avoid it? When your problem is only moving a fixed asset under simple conditions, a deliberately limited, non-programmable ledger (like Bitcoin) buys you a smaller attack surface and cheaper verification. General-purpose computation is the wrong tool when you don’t need computation.
- What breaks if I remove it? Remove programmability and you’re back to Bitcoin’s model: no contracts, no tokens-in-storage, no on-chain applications — just value transfer under a fixed menu of rules. The “world computer” collapses back into a “world ledger.”
Check your understanding
Section titled “Check your understanding”- Bitcoin adds a new capability by extending its transition function’s fixed menu (a new tx type or opcode). How does Ethereum add the same capability instead, and why does that scale better?
- What are the three ingredients of the “world computer” mental model — its state, its processor, its inputs — and what makes it a world computer rather than just a computer?
- “No one owns it and everyone shares it” is described as a structural consequence, not a policy. A consequence of what, exactly? Give one concrete privilege that therefore cannot exist.
- Using the
counter_codeexample, explain whatSStore/SLoaddo that Bitcoin Script has no equivalent of, and why that single ability is what turns a ledger into a general-purpose computer. - Arbitrary programs can loop forever, and the halting problem says you can’t reliably screen them out in advance. Given that, what is the only workable defense, and what native asset pays for it?
Show answers
- Ethereum generalizes the last step of the transition function to “run whatever program the transaction targets.” A new capability is written as a contract and deployed in one transaction by anyone, with no protocol change. It scales because the base layer never has to learn about the application — the cost of a new capability drops from a network-wide fork to a single transaction.
- State = a map from account address to its balance, nonce, and (for programs) code and storage; processor = a virtual machine that runs contract bytecode; inputs = transactions ordered into blocks. It is a world computer because it is replicated on every node — thousands of identical copies each recompute and must agree, so “the computer” is the consensus about what they all compute.
- A consequence of no single copy being authoritative — the machine is every node at once, so there is no operator to be root. Therefore there can be no privileged account that freezes a balance or edits another account’s storage, no off switch, and no gatekeeper on who may deploy or call code. (Any one of those is a valid concrete example.)
SStorewrites to, andSLoadreads from, the contract’s own slice of the shared world state — memory that persists between calls and lives in the chain, not in any one process. Bitcoin Script has no persistent memory: a script verifies one spend and is done. Once code can carry state forward across transactions, programs can remember and evolve — which is exactly what makes the ledger a general-purpose computer rather than a value-transfer system.- Since you can’t decide termination in advance, the only workable defense is to run the program but charge for every step and cap how much it may consume, halting it when the budget is exhausted — you make non-termination unaffordable instead of trying to detect it. The asset that pays for each step is ether.