Finance / Ethereum

Ethereum

How a blockchain can run programs, not just record payments: accounts, a shared state, a virtual machine, fees measured in gas, and validators who stake ether.

Intermediate7 steps~7 min
Alice — a user account, controlled by a key
Bob — another user account
Contract — a program stored on the chain
Validator — stakes ether, proposes and checks blocks
// THE SHORT VERSION

In 30 seconds

Ethereum is a blockchain that runs programs. Besides ordinary user accounts it has contract accounts: code with its own storage that lives on the chain.

A transaction can send ether or call a contract. Every node runs the call on the same simple machine, the EVM, so all arrive at the same new state.

Each instruction costs gas, paid in ether, which rations a computer that thousands share. Since 2022 blocks are proposed by validators who lock up ether as a stake, not by miners. Bugs, fees and limited capacity are the main costs.

Ethereum, step by step

STEPS01 / 07

Simplified: the instruction list is shortened and the 20 gwei gas price is an assumed round number, not a market figure. This explains the mechanism; it is not advice to buy or use anything.

STEP 01 / 07 A chain that runs programs
THE MATH
Bitcoin: who paid whom Ethereum: payments + programs and their data
  1. Step 1: A chain that runs programs. Bitcoin’s blocks record payments. Ethereum, launched in 2015, keeps the same kind of shared chain but lets its blocks also carry calls to programs stored on the chain itself, called smart contracts. Every node runs those programs and must reach the same result.
  2. Step 2: Two kinds of account. Ethereum tracks accounts rather than coins. A user account is controlled by a private key and has a balance of ether. A contract account is controlled by its code, and also has storage: here a single number, count. Only a key-holder can start a transaction; a contract runs only when called.
  3. Step 3: One shared state. The state is the full table of every account: balances, code and storage. A transaction is a signed request to change it. Alice sends Bob 1 ether: her balance drops by 1 plus a fee, his rises by 1. Every node applies the same transactions in the same order, so all copies of the state agree.
  4. Step 4: The virtual machine. Alice now calls increment(). Each node runs the contract’s code on the Ethereum Virtual Machine, a simple stack computer that executes one small instruction at a time. It reads count, adds 1 and writes 8 back. The EVM is defined exactly, so every node computes the same new state.
  5. Step 5: Ether and gas. Each instruction costs a fixed amount of gas, and the sender pays for it in ether. A plain transfer is always 21,000 gas; at an assumed 20 gwei per gas that is 0.00042 ETH. A gas limit caps the work, so a looping program just runs out. The base fee is destroyed; the tip goes to the validator.
  6. Step 6: Proof of stake. Since September 2022 Ethereum has no miners. Validators lock up at least 32 ether as a stake. Every 12 seconds one is picked at random to propose a block, and others vote on it. Once votes from two thirds of all stake build up, about 13 minutes later, the block is final. A validator caught cheating loses part of its stake.
  7. Step 7: Limits and risks. Running programs on thousands of machines is slow and costly, so fees climb when the chain is busy and much activity moves to separate “layer 2” networks. A deployed contract is public and hard to change: bugs have been exploited for large sums. Ether’s price is volatile, and mistakes cannot be reversed.
VALUES SO FAR
Alice····account
count····storage
transfer····input
count····result
gas····rule
fee····result
Alice····result
stake····rule
slot····rule

Spotted a mistake on this page?