Education › Blockchain › Stage 2: Ethereum and smart contracts

Ethereum and the EVM

Accounts, state, transactions and gas — the world computer that runs smart contracts.

Beginner→Intermediate ~33 min read Module 5 of 16

Bitcoin's ledger tracks who owns how many coins. Ethereum's ledger does something far more powerful: it runs programs. This lesson explains the model that makes that possible — Ethereum as a single, shared 'world computer' whose state everyone agrees on, the two kinds of account that live in it, how transactions change its state, and how gas meters the whole thing. Get this model straight and smart contracts, which come next, will feel like a natural extension rather than a mystery.

After this module you can
  • Explain Ethereum as a shared state machine — the 'world computer' and the EVM
  • Distinguish externally owned accounts from contract accounts
  • Describe how a transaction changes global state, and the role of the nonce
  • Read gas, ether units, and the base-fee model at a working level

One world computer, shared by everyone

The clearest way to picture Ethereum is as a single global computer that everyone shares and no one owns. It has one memory — the world state — recording every account's balance and every contract's data. Transactions are the only way to change that state, and every node runs the same rules to compute the new state after each block, so all honest nodes always agree on exactly what the shared computer's memory contains. The program that executes transactions and contract code is the Ethereum Virtual Machine (EVM). Every node runs an identical EVM, which is why a contract behaves the same everywhere. This is the leap from Bitcoin: instead of a ledger of coin balances, Ethereum is a ledger of *state* that arbitrary programs can read and change under strict, deterministic rules.

Note

Determinism is essential. The EVM must produce the exact same result on every node, or consensus would break — so contract code can't do anything unpredictable (no random numbers, no reaching out to the internet). Every input to a computation must already be on-chain. This constraint shapes everything about how contracts are written.

Two kinds of account

Everything on Ethereum is an account, and there are exactly two types. An externally owned account (EOA) is controlled by a private key — this is a user's wallet. It has a balance and can *start* transactions by signing them. A contract account is controlled by its code, not a key. It has a balance and, crucially, its own persistent storage, and it runs its code whenever a transaction calls it. It cannot start a transaction on its own; it only acts when triggered. The distinction is fundamental: EOAs are the users who initiate action, contracts are the programs that respond. A smart contract is simply the code and storage sitting at a contract account's address.

PropertyExternally owned (EOA)Contract account
Controlled byA private keyIts own code
Can start a transactionYes (by signing)No — only reacts when called
Has a balanceYesYes
Has code and storageNoYes — persistent on-chain state

State, transactions and the nonce

A transaction is a signed instruction from an EOA that changes state: sending ether, deploying a contract, or calling a contract's function. Each transaction includes the sender, the recipient (an address or a contract), any ether value, optional data (which function to call and with what arguments), and gas settings. Every EOA also has a nonce — a counter of how many transactions it has sent. The nonce forces transactions from one account to be processed strictly in order and exactly once, which prevents someone from replaying an old signed transaction to, say, drain your account twice. If your first transaction is stuck, later ones wait behind it, because each nonce must be used in sequence.

text
transaction {
  from:   0xAlice...        // an EOA, identified by signature
  to:     0xContract...     // an EOA (send ether) or a contract (call it)
  value:  0.1 ETH           // ether to transfer, if any
  data:   mint(5)           // which function + args, if calling a contract
  nonce:  7                 // Alice's 8th transaction (0-indexed)
  gas:    { limit, maxFee, priorityFee }
}
// The network applies this to the world state, in nonce order, exactly once.

Gas and the fee model, a little deeper

You met gas in the last lesson: gas measures computational work, and you pay for it. Ethereum's current fee model (introduced by EIP-1559) splits the price into two parts. A base fee is set automatically by the network based on how full recent blocks were — it rises when demand is high and falls when it's low, and it is *burned* (removed from supply). On top, you add a priority fee (a 'tip') to incentivise validators to include your transaction sooner. You also set a gas limit: the maximum gas you'll allow, protecting you from a runaway contract call. Your cost is roughly gas used × (base fee + priority fee), never exceeding your limit.

Tip

Because the base fee tracks demand, the same transaction can cost very different amounts hour to hour. Wallets estimate it for you, but when the network is congested, waiting for a quieter time — or using a Layer 2 (a later lesson) — can cut fees dramatically.

Ether units and reading the chain

Ether comes in units that trip up beginners. The base unit is the wei — the smallest, indivisible amount. Gwei is a billion wei, the convenient unit for expressing gas prices. Ether is 10^18 wei. Contracts and libraries almost always work in wei internally, so 1 ether is written as the integer 1000000000000000000; getting a units conversion wrong by a few zeros is a classic bug. You explore all of this — accounts, balances, transactions, contract code — through a block explorer like Etherscan, which presents the public world state in a readable form. Anyone can inspect any account or transaction, because the state is public.

  • wei — the smallest unit; contracts compute in wei.
  • gwei — a billion wei; used for gas prices.
  • ether — 10^18 wei; the human-facing unit.
  • block explorer (Etherscan) — read any account, transaction or contract.

That is the whole Ethereum model: a shared world computer, two kinds of account, transactions that change state in nonce order, gas that meters the work, and public state anyone can read. With this in hand, the next lesson introduces Solidity — the language you write the contract code in that lives at those contract accounts.

Hands-on practice

Explore the world computer

  1. In your own words, explain why the EVM must be deterministic and what that forbids (randomness, internet calls).
  2. State the difference between an EOA and a contract account, and which one can start a transaction.
  3. Open any transaction on a block explorer and identify the from, to, value, nonce and gas fields.
  4. Explain what the nonce prevents, using the example of replaying a signed transaction.
  5. Convert 1 ether to wei and to gwei, and explain why contracts work in wei.
Cheat sheet

Ethereum and the EVM — at a glance

Main things to focus on

  • Ethereum is a shared world computer; its memory is the world state, executed by the EVM.
  • The EVM is deterministic — no randomness or internet, every input must be on-chain.
  • EOAs are key-controlled wallets that start transactions; contract accounts are code with storage.
  • A transaction is a signed state change; the nonce orders an account's transactions and stops replays.
  • EIP-1559 fees = a burned base fee (set by demand) plus a priority tip, capped by a gas limit.
  • Units: wei (smallest), gwei (billion wei, for gas), ether (10^18 wei).

The model

world statethe shared memory of all accounts
EVMthe virtual machine every node runs
deterministicsame result on every node
no randomness/netinputs must be on-chain

Accounts

EOAkey-controlled wallet; starts transactions
contract accountcode + storage; reacts when called
addressidentifies either kind of account
balanceether held, on both kinds

Transactions

from / tosender EOA and recipient/contract
valueether transferred, if any
datawhich function to call, with args
nonceorders txs; blocks replays

Fees & units

base feeauto-set by demand; burned
priority feetip to be included sooner
gas limitmax gas you'll allow
wei / gwei / ether1 ether = 10^18 wei

Common pitfalls

  • Expecting a contract to use randomness or fetch from the internet — the EVM forbids it.
  • Confusing an EOA (starts transactions) with a contract account (only reacts).
  • Ignoring the nonce and being surprised when a stuck transaction blocks later ones.
  • Getting ether/wei conversions wrong by a few zeros — a classic, costly bug.
  • Assuming a fixed fee when the base fee moves with network demand hour to hour.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →