Track 1 · Mechanics · lesson 8
The chain as a state machine
7 min
Here is the reframe that makes everything after this track easier.
Blocks are not the point. They are the mechanism. The point is the state — and a blockchain is a machine for changing it under rules nobody can bend.
Formally:
newState = apply(oldState, block)
The state is the balance of every account, the code of every contract and the
contents of every storage slot. A block is a batch of instructions for changing
it. apply is the EVM.
Give any two machines the same old state and the same block, and they must produce byte-identical new state. That determinism is the whole basis of agreement.
This is why there is no randomness in the EVM, no clock you can trust, and no network access. Anything that could differ between two machines would break consensus, so it is not available at all.
Predict
A contract needs a random number to pick a raffle winner. Why can it not just generate one?
Why full nodes can be trusted
A node does not accept a block because someone reputable sent it. It replays every transaction against its own copy of the state and checks that the result matches the state root in the header.
If it does not match, the block is rejected — no appeal, no vote.
This is what makes a blockchain different from a shared database. A database trusts whoever holds the write credentials. A blockchain trusts arithmetic that anyone can redo.
"Don't trust, verify" is not a slogan here. It is a literal description of what the software does on every block.
Check
Two nodes disagree about a balance after processing the same block. What follows?
Worth remembering
- A blockchain is a state machine: newState = apply(oldState, block).
- State is every balance, every contract's code and every storage slot.
- Execution must be perfectly deterministic, so the EVM has no randomness, no reliable clock and no network access.
- Nodes verify by replaying and comparing to the state root, not by trusting the sender.