Track 3 · Ethereum & the EVM · lesson 7

Local, testnet, mainnet

5 min


Three places to run a contract. Only one of them can lose you money.

| | Speed | Cost | Who else sees it | |---|---|---|---| | Local | instant | free | nobody | | Testnet | ~12s blocks | free | anyone | | Mainnet | ~12s blocks | real ETH | everyone |

Local

A chain running on your machine — Anvil, Hardhat, or the one in your browser right now.

Instant blocks, unlimited free ETH, and you can rewind time or impersonate any account you like. This is where the overwhelming majority of development happens, and it is where you have been all along.

The Forge you have been using is a local chain. Not a simulation of one — a real EVM executing real bytecode, with the conveniences a local chain always has.

Which means you have already done the part most courses treat as the finish line. Track 6 moves the same contracts to a public network, and almost nothing about writing them changes.

Testnet

A public network that behaves like mainnet but whose ETH is worthless. Sepolia is the main one for Ethereum today.

You get it free from a faucet, deployments are visible on a real block explorer, and other people can interact with your contract. What you do not get is any guarantee of permanence — testnets get reset or deprecated, and validator support is best-effort.

Predict

Your contract works perfectly on a testnet. What might still break on mainnet?

Choose one answer

Mainnet

Real ETH, real users, permanent consequences.

A short checklist before anything of yours goes there:

The plan said this at the start and it is worth repeating now that you can actually write contracts: never put real funds into a contract you wrote in order to find out whether it works.

Test on a local chain. Test on a testnet. Then decide separately whether it deserves real money.

Check

Why develop locally rather than straight on a testnet?

Choose one answer

Worth remembering

  • Local chains give instant blocks, free ETH and full control — where most development happens.
  • Testnets are public and free but impermanent; Sepolia is the current default.
  • Mainnet is the only one where mistakes cost real money.
  • Testnets cannot reproduce economic attacks, because there is nothing worth attacking.
  • Never fund a contract with real money to find out whether it works.