Revision · Project 6 — Ethereum Mini-Chain
Project 6 built ethmini, an Ethereum-style mini-chain that trades Bitcoin’s coin set for a programmable world computer: accounts instead of UTXOs, a mutable world state, and a virtual machine anyone can deploy code to. Here’s what to carry forward.
What this part covered
Section titled “What this part covered”- Accounts vs UTXO — instead of a set of coins, each address is an
Accountrecord (balance, nonce, storage, code); this is mutable shared state, and the nonce is replay protection you have to build so a signed transaction can’t be resent. - World state as a state machine —
WorldState::applyis the state-transition function: validate, mutate, and maybe revert. It must be deterministic (every node computes the identical next state) and atomic (a failed call leaves no partial writes). - The state root — the entire world collapses to one 32-byte SHA-256 fingerprint; change one storage slot and the root changes, change nothing and it’s identical, which is how nodes agree byte-for-byte.
- A tiny stack VM — bytecode is a sequence of opcodes modeled as an enum, run by an interpreter loop over a stack; the demo is deliberately honest about simplifications (64-bit words, SHA-256 instead of Keccak).
- Gas as the halting-problem answer — untrusted code might loop forever, so every instruction costs gas, and running out causes an exceptional halt that reverts; gas is the price of Turing-completeness.
- Smart contracts, demystified — deploying stores bytecode in an account; calling runs that code against its own storage via
SSTORE/SLOAD, so a “smart contract” is just a few bytes living in an account run by a gas-metered loop. - PoW to PoS — the closing question of whose state is canonical moves from proof-of-work to proof-of-stake.
The takeaway
Section titled “The takeaway”The recurring question sharpens to atomicity and ownership of mutable state: a call mutates a clone, and Rust’s move semantics make “commit the new state or drop it entirely” the natural shape, so a reverted call can’t leak a half-written slot. And the project’s own question — what Ethereum solved — is the leap from a calculator to a shared world computer. Project 7 then asks the follow-up that a contract-holds-its-storage model forecloses: how do you run thousands of transactions in parallel?