Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 47 ยท Getting Started

What Is Ethereum?

Meet Ethereum before you write Solidity: accounts, transactions, gas, blocks, the EVM and ETH, plus a tiny runnable account-and-balance state machine.

Solidity is a language for programs that live on Ethereum, so it helps to know what that place is before you write a line of code. Ethereum is a network of thousands of computers (called nodes) that all keep the same copy of a shared database and agree, block after block, on how it changes. You can think of it as one very slow, very public, very hard-to-cheat computer that nobody owns.

The database is called the state. It holds every account, its balance and, for accounts that have code, that code and its stored data. Programs stored on the network are called smart contracts, and Solidity is the most common language for writing them. This lesson explains the moving parts you will meet in every later lesson. If you want the deeper theory (hashes, consensus, forks), the Blockchain tutorial covers it, and Ethereum in Practice models the same ideas in Python.

Ethereum in four pieces

Accounts Addresses that hold ETH and, sometimes, code.
Transactions Signed requests to change the state.
Gas The fee that pays for computation.
Blocks Batches of transactions, added in order.

Everything else in this tutorial builds on these four.

1 / 2

Accounts

Everything on Ethereum starts with an account, identified by a 20-byte address that is usually written in hexadecimal, like 0x5B38...eddC4. There are two kinds:

Externally owned account (EOA) Contract account
Controlled by A private key (your wallet) Its own code
Holds A balance A balance, code and storage
Can start a transaction Yes No, it only reacts to calls

Each account also has a nonce, a counter of how many transactions it has sent (or, for a contract, how many contracts it has created). The nonce makes every transaction unique, so a signed transaction cannot be replayed.

Only a private key can sign a transaction, which is why every chain of activity on Ethereum begins at an EOA. A contract can call other contracts while it runs, but a person's wallet always pulled the first lever. You will learn how addresses are derived from keys in Keys, Addresses and Wallets.

ETH and its units

ETH (ether) is the network's native currency. It pays for computation, and it can be sent between accounts and held by contracts. Balances are stored as whole integers of the smallest unit, wei, because the EVM has no decimals:

  • 1 ETH = 1,000,000,000,000,000,000 wei (10^18)
  • 1 gwei = 1,000,000,000 wei (10^9), the unit used for gas prices

Solidity uses the same integers, and you will see 1 ether and 1 gwei as built-in literals later. Because 10^18 is bigger than a normal JavaScript number can hold exactly, the examples in this tutorial use BigInt for money.

Transactions

A transaction is a signed message from an EOA that asks the network to change the state. A transaction has these main fields:

  • from: the sender (proved by the signature, not typed in)
  • to: the recipient address, or empty when deploying a new contract
  • value: an amount of wei to send
  • data: optional bytes, which is how you tell a contract which function to run
  • nonce: the sender's next counter value
  • a gas limit and fee settings

There are three common kinds: sending ETH to another account, calling a contract function (with data), and creating a contract (with empty to and the compiled code in data).

Gas

Every step a contract takes costs gas. Gas exists for one reason: anyone can submit code, including a loop that never ends, and every node has to run it. Because the sender pays per step and declares a gas limit up front, a runaway program simply runs out of gas and stops.

The fee works like this. The protocol sets a base fee per unit of gas that adjusts with demand and is burned. The sender may add a priority tip for the block producer. So:

fee = gas used x (base fee + tip)

A plain ETH transfer between two accounts uses exactly 21,000 gas. Contract calls use more, depending on what they do. Writing to storage is the expensive part, and Gas Costs and Optimization comes back to it. For now remember the rule of thumb that computation is cheap and storing data forever is costly.

If execution fails or runs out of gas, the state changes of that transaction are undone, but the sender still pays for the work the nodes did.

Blocks

Transactions are collected into blocks. Each block points to the one before it, which is where the word blockchain comes from. Since the move to proof of stake in 2022, a new block is proposed roughly every 12 seconds by a validator who has locked up ETH as a deposit, and other validators vote on it. Once enough time passes and enough votes pile up, the block is finalized and effectively permanent. See Proof of Stake for how that agreement works.

For you as a contract author, the consequences are practical:

  • A transaction is not instant. It waits in a pool, then lands in a block.
  • Order matters, and the block producer chooses it (a root of several security issues later).
  • Everything is public. Anyone can read every transaction and all contract storage.

The EVM, as a concept

The Ethereum Virtual Machine (EVM) is the engine every node runs to execute contract code. You never write EVM instructions directly. You write Solidity, a compiler turns it into bytecode, and the EVM runs the bytecode. What matters is that the EVM is deterministic: the same code with the same input and the same starting state always produces the same result on every node. That is how thousands of strangers can agree without trusting each other. How a Smart Contract Runs builds on this.

Mainnet and testnets

The real network, where ETH has real value, is called mainnet. Mistakes there cost money and cannot be undone, so developers practice on testnets: networks with the same rules but worthless coins from free faucets. Sepolia is the long-standing testnet for application developers. You will also run a private local chain on your own machine, which is the fastest way to learn. Deploying to Testnet and Mainnet covers the steps.

A tiny state machine you can run

Real Ethereum is far bigger, but its core loop is small: validate a transaction against the state, apply it, charge gas, and collect transactions into blocks. The stand-in below is not Ethereum; it is a toy with the same shape. It keeps accounts in a Map, uses BigInt for wei, checks the nonce and the balance, and burns a fixed 21,000 gas at a flat price.

JS A toy account-and-balance state machine

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second transaction is a replay of the first, and the nonce check rejects it. Bob's transaction fails because he cannot afford the value plus the fee. In the real system the sender would still pay for a failed transaction that was included in a block; this toy simply rejects it before it gets that far.

Now group transactions into blocks, each linked to the previous one by a hash-like fingerprint. The fingerprint below is a simple stand-in checksum (real Ethereum uses Keccak-256), but it shows why changing history is detectable.

JS Blocks linked by fingerprints

Press Run (or Ctrl + Enter) to see the console output here.

No output.

What is real here: accounts, nonces, wei, the 21,000-gas transfer and the idea of linked blocks follow Ethereum. What is the stand-in: there are no signatures, no networking, no real hashing, no base fee that moves, and no validators. Real nodes also keep far more in the state than balances and nonces.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which kind of account can start a transaction?

    Only a private key can sign a transaction, so only externally owned accounts start one. Contracts react to calls, and can call other contracts during execution.
  2. 2. What is the purpose of gas?

    Each step costs gas, and the sender sets a gas limit. A runaway loop runs out of gas and stops, and every node is protected from free unbounded work.
  3. 3. A plain ETH transfer between two accounts uses how much gas?

    The base cost of a transaction, and the whole cost of a simple transfer, is 21,000 gas. The amount of ETH sent does not change it.
  4. 4. What does it mean that the EVM is deterministic?

    Every node re-runs the transaction and must reach an identical result, which is how strangers agree without trusting each other.

Summary

  • Ethereum is a shared state (accounts, balances, contract code and storage) that thousands of nodes keep in agreement.
  • EOAs are controlled by keys and start transactions; contract accounts hold code and storage and react to calls.
  • Balances are integers in wei (1 ETH = 10^18 wei), so use BigInt when you model money.
  • Gas prices computation; a failed transaction undoes its state changes but still costs gas.
  • Transactions are grouped into blocks roughly every 12 seconds; everything is public.
  • The EVM runs compiled bytecode deterministically. Practice on testnets and local chains before touching mainnet.

Next: How a Smart Contract Runs.