⚠ Trading involves significant risk of loss. Everything on this site is for education only and is not financial advice.
Lesson 1 of 13 · Free

Ethereum: Smart Contracts, Gas and Proof of Stake

Understand what a smart contract is, calculate Ethereum transaction fees in gwei and euros, and see how proof of stake secures the network.

Author: Moustafa HijaziContent reviewed: 2026-10-305 min readSelf-study course

What you will learn

  • What a smart contract is and what it can and cannot do.
  • How gas, the base fee and the priority fee combine into a transaction fee.
  • How to convert a fee from gwei into ETH and euros.
  • How proof of stake works on Ethereum and which risks validators carry.

Explanation

The Bitcoin course explained blocks and proof of work. Ethereum keeps the shared ledger but adds a general-purpose computer on top.

Accounts and smart contracts

Ethereum has two kinds of accounts. An externally owned account (EOA) is controlled by a private key, like a normal wallet. A contract account holds code. A smart contract is a program stored on the blockchain that runs exactly as written when someone sends it a transaction. It can hold tokens, follow rules ("release funds if condition X is true") and call other contracts.

Important limits: a smart contract cannot fix its own bugs, cannot see the outside world without an oracle (a service that feeds external data such as prices onto the chain), and "code is law" only means the code runs as written, not that it is fair or correct. Many contracts can be changed by an administrator key through an "upgrade" function, which is a trust assumption you should check.

Tokens

Most tokens on Ethereum follow the ERC-20 standard (ERC = Ethereum Request for Comments), a common set of functions such as "transfer" and "approve". An approval gives a contract permission to move your tokens. Unlimited approvals are a common risk: if the approved contract is later exploited, your tokens can be taken.

Gas and fees

Every operation costs gas, a unit that measures computing work. A simple ETH transfer uses 21,000 gas. A token swap often uses 100,000–200,000 gas. The price of gas is quoted in gwei: 1 gwei = 0.000000001 ETH (one billionth of an ETH).

Since the London upgrade in August 2021 (EIP-1559, EIP = Ethereum Improvement Proposal), the gas price has two parts:

  • Base fee: set by the protocol for each block and burned (destroyed). It rises by up to 12.5% after a block that is more than half full and falls after a block that is less than half full.
  • Priority fee (tip): paid to the validator who includes your transaction.

Formula: fee (ETH) = gas used × (base fee + priority fee) in gwei × 0.000000001. Your wallet also sets a max fee; if the base fee is lower, the difference is not charged. A transaction that fails still pays for the gas it used.

Proof of stake

Since "the Merge" on 15 September 2022, Ethereum uses proof of stake (PoS). Instead of miners spending electricity, validators lock ETH as a deposit (stake). A full validator needs at least 32 ETH. Time is divided into 12-second slots; in each slot one validator proposes a block and others vote ("attest"). 32 slots form an epoch (6.4 minutes), and blocks become final (practically irreversible) after about two epochs.

Validators earn rewards for correct work. They lose small amounts when offline and can be slashed (lose part of the stake and be removed) for provably dishonest behaviour such as signing two different blocks for the same slot. Staking yields are covered in Lesson 7.

Protocol changesEthereum is upgraded regularly through hard forks (for example Dencun in 2024, Pectra in 2025 and Fusaka in late 2025). Numbers such as gas limits and staking parameters can change, so check current documentation before relying on them.

Worked example

Hypothetical example: you send ETH and later make a token swap. Assumptions: base fee 20 gwei, priority fee 2 gwei, ETH price €2,000. Price changes during the transaction, wallet fees and exchange spreads are excluded.

  1. ETH transfer: 21,000 gas × (20 + 2) gwei = 462,000 gwei.
  2. Convert: 462,000 × 0.000000001 = 0.000462 ETH.
  3. In euros: 0.000462 × €2,000 = €0.92 (rounded).
  4. Of this, burned: 21,000 × 20 = 420,000 gwei = 0.00042 ETH. Tip to the validator: 21,000 × 2 = 42,000 gwei = 0.000042 ETH.
  5. Token swap using 150,000 gas: 150,000 × 22 = 3,300,000 gwei = 0.0033 ETH = €6.60.
  6. If the next block is full, the base fee may rise by 12.5%: 20 × 1.125 = 22.5 gwei. Fees change from block to block.

The lesson: the fee depends on the complexity of the action (gas used) and on demand for block space (base fee), not on the amount of money moved.

Common mistake

Thinking "verified contract" means "safe contract"A contract whose code is public and verified can still contain bugs, admin keys that can change it, or unlimited approvals that drain your wallet later. Read what you are approving, prefer limited approvals, and revoke approvals you no longer need.

Practice activity

On paper: you approve a token (46,000 gas) and then swap it (180,000 gas). Hypothetical data: base fee 30 gwei, priority fee 1 gwei, ETH price €2,500. Calculate (a) the total fee in ETH and euros, (b) the part that is burned, in euros.

Show solution

(a) Total gas: 46,000 + 180,000 = 226,000. Fee: 226,000 × 31 gwei = 7,006,000 gwei = 0.007006 ETH. In euros: 0.007006 × €2,500 = €17.52 (rounded).

(b) Burned: 226,000 × 30 gwei = 6,780,000 gwei = 0.00678 ETH × €2,500 = €16.95. The tip is 226,000 gwei = 0.000226 ETH = €0.57 (rounded).

Limitations: real gas use differs by token and contract, and the base fee can change between your two transactions.

Key takeaways

  • A smart contract runs exactly as written, including its bugs and admin powers.
  • Fee = gas used × (base fee + priority fee); the base fee is burned.
  • Fees depend on complexity and network demand, not on the amount sent.
  • Proof of stake replaces miners with validators who lock ETH and can be penalised or slashed.

Next step

In the next lesson you will see how Layer 2 networks reduce these fees and what new risks they add.

Self-check

Answer the questions, then check your answers. You can retry as often as you like.

1. A swap uses 120,000 gas. The base fee is 25 gwei and the priority fee is 1 gwei. What is the fee in ETH?

2. Under EIP-1559, what happens to the base fee part of a transaction fee?

3. Which statement about a smart contract is correct?

Automatic self-check for your own revision. Your answers are checked in your browser and are not seen or assessed by us. It is not an exam and not a qualification.

Your progress

“Complete” only means you marked the lesson as done. It is not a test of your understanding. Progress and notes are saved only in this browser on this device — not in an account.