Lesson 2 of 4 Ethereum Fundamentals

Accounts, Transactions and Blocks

Accounts hold state, transactions change it, and blocks record the changes in order. This lesson explains the two account types, the fields of a transaction, the transaction types in use today, and how a transaction travels from a wallet to a finalised block.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish externally owned accounts from contract accounts.
  • Describe the fields of a transaction and the transaction types in use.
  • Explain how the nonce orders transactions and prevents replay.
  • Trace a transaction from signing to finality.
  • Interpret the status and gas fields of a receipt.

Externally owned accounts and contract accounts

Ethereum's world state maps 20-byte addresses to accounts. Every account has four fields: a nonce, a balance in wei, a code hash and a storage root. There are two kinds of account, compared below.

Externally owned account (EOA)
Controlled byA private key
Has codeNo (unless delegated with EIP-7702)
Can start transactionsYes
Nonce countsTransactions sent
Address derived fromThe public key
Contract account
Controlled byIts code
Has codeYes, fixed at deployment
Can start transactionsNo; it runs only when called
Nonce countsContracts created
Address derived fromThe deployer and its nonce (or a CREATE2 salt)

An EOA's private key is a random 256-bit number. The public key is derived from it with elliptic curve cryptography (secp256k1), and the address is the last 20 bytes of the Keccak-256 hash of the public key. Addresses are usually written in mixed-case hexadecimal (EIP-55), where the case of each letter is a checksum that catches typing errors. Since the Pectra upgrade (May 2025), EIP-7702 lets an EOA delegate to contract code, which wallets use for features such as batched transactions, but the account is still controlled by its key.

Sort into groups

EOA or contract account?

Exam skills 7.1.1

Decide which kind of account each description belongs to.

Log in to try this activity Interactive activities are free with an account.

What a transaction contains

A transaction is a message signed by an EOA. The following table lists the fields of a typical EIP-1559 transaction.

FieldPurpose
nonceThe sender's transaction count; each transaction must use the next number, which orders them and prevents replay
toThe recipient address; empty for contract creation
valueWei transferred to the recipient
data (input)Calldata: an encoded function call, or creation bytecode for a deployment
gas (gas limit)The most gas the transaction may use
maxFeePerGas, maxPriorityFeePerGasThe fee the sender is willing to pay per unit of gas
chainIdThe network the transaction is valid on
v, r, sThe signature, from which nodes recover the sender's address

There is no "from" field: nodes recover the sender from the signature. Transaction types in use are legacy (type 0, with a single gasPrice), access-list (type 1), EIP-1559 (type 2, the default), blob transactions used by rollups (type 3) and set-code transactions for EIP-7702 (type 4).

Match the pairs

Transaction fields

Exam skills 7.1.2

Match each field of an EIP-1559 transaction with what it does.

Log in to try this activity Interactive activities are free with an account.

The transaction lifecycle

The following sequence shows how a transaction moves from a wallet into the chain.

  1. Sign

    The wallet builds the transaction, fills in the nonce, gas limit and fees, and signs it with the private key.

  2. Broadcast

    A node receives it through eth_sendRawTransaction, checks the signature, nonce and balance, and gossips it to peers.

  3. Wait in the mempool

    The transaction is pending and publicly visible in nodes' transaction pools.

  4. Include

    A block proposer selects it, usually by priority fee, executes it and includes it in a block with a receipt.

  5. Confirm and finalise

    Later blocks build on that block; after about two epochs, the block is finalised.

A transaction can fail at different points. If its nonce is already used, or its sender cannot pay the maximum fee, nodes reject it before inclusion. If its execution reverts or runs out of gas, it is still included in a block, its receipt has status 0, its state changes are undone and the gas it used is paid.

The following diagram shows the stages and where a transaction can fail.

The lifecycle of a transaction. The wallet fills in the nonce, gas limit and fees and signs it. A node receives it through eth_sendRawTransaction, checks it and gossips it to peers, and it waits, publicly visible, in the mempool. A block proposer includes it, usually by priority fee, and produces a receipt. After about two epochs the block is finalised. A transaction with a used nonce or unaffordable fee is rejected before inclusion; one that reverts is still included, with status 0, and its gas is paid.
A reverted transaction is included and paid for.
Scenario questions

Where did it fail?

Exam skills 7.1.2

Work out what happens to transactions that fail at different points of their lifecycle.

Log in to try this activity Interactive activities are free with an account.

Blocks

A block has a header and a body. The header holds the parent block's hash, the block number, timestamp, gas limit, gas used, base fee, the fee recipient (the proposer's chosen address) and three Merkle-Patricia trie roots: the state root, the transactions root and the receipts root. These roots let anyone prove that a transaction, receipt or account value belongs to a block without downloading everything.

Blocks are proposed every 12 seconds. The block gas limit caps the total gas of a block and is adjusted gradually by validators; since the Fusaka upgrade, one transaction may use at most 16,777,216 gas regardless of the block limit.

Select all that apply

Inside a block header

Exam skills 7.1.2

Identify what a block header holds and why.

Log in to try this activity Interactive activities are free with an account.
Worked example

A stuck transaction

A user sends three transactions from the same account with nonces 7, 8 and 9. Transaction 7 was sent with a very low maximum fee and is still pending; 8 and 9 had high fees. Why have none of them been included?

Transactions from one account must be included in nonce order. Nonce 7 cannot be included while its maximum fee is below the base fee, so 8 and 9 wait behind it, however high their fees. The user can replace transaction 7 by sending a new transaction with nonce 7 and a higher fee (wallets call this speeding up), or cancel it by sending a zero-value transaction to themselves with nonce 7. Once nonce 7 is included, 8 and 9 follow.

Worked example

Reading a receipt

A developer's script reports that a transaction to a contract was mined, but the contract's state did not change. The receipt shows status: 0 and gasUsed: 29874. What happened?

Status 0 means the transaction reverted: it was included in a block, but all its state changes were undone. The 29,874 gas consumed up to the revert was still paid. The developer should simulate the same call with eth_call or estimateGas to read the revert reason, then fix the input or the contract. Checking status, not only whether a receipt exists, is essential in any application that sends transactions.

Check yourself

A transaction has no "from" field. How do nodes know who sent it?

Show answer

They recover the sender's public key, and therefore address, from the signature (v, r, s) and the transaction data. Only the holder of the private key could have produced that signature.

Exam Tips

Remember for the exam

  • EOAs are controlled by keys and start transactions; contract accounts run only when called.
  • The nonce orders an account's transactions; a pending low nonce blocks higher ones.
  • There is no from field: the sender is recovered from the signature.
  • A reverted transaction is still mined, has status 0 and pays for gas used.