L10: Solidity Basics

Set up your Solidity development environment, write and compile your first contracts, and deploy them to the Sepolia testnet using Remix IDE.

Tool Overview

What you will use in this lesson

  • Remix IDE — browser-based Solidity editor, compiler, and deployer (no installation needed)
  • MetaMask — browser wallet for signing transactions and switching networks
  • Sepolia Faucet — source of free testnet ETH for paying gas fees

Guided Activities

1

Set Up Remix IDE

Tool: remix.ethereum.org
  1. Open remix.ethereum.org in your browser. No login or installation required.
  2. In the left panel, click the File Explorer icon (top icon, looks like two pages).
  3. Click the + icon next to "contracts" to create a new file. Name it SimpleStorage.sol.
  4. Paste the following starter contract into the editor:
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; contract SimpleStorage { uint256 public storedNumber; function store(uint256 _number) public { storedNumber = _number; } function retrieve() public view returns (uint256) { return storedNumber; } }
  1. Click the Solidity Compiler icon in the left panel (looks like an "S" with an arrow).
  2. Set the compiler version to 0.8.20 or newer from the dropdown.
  3. Click Compile SimpleStorage.sol. A green checkmark means success.
Reflection question: What does pragma solidity ^0.8.20 mean? Why is it important to pin a minimum compiler version in production contracts?
2

Deploy to the JavaScript VM

Tool: Remix Deploy Tab
  1. Click the Deploy & Run Transactions icon in the left panel (looks like an Ethereum diamond with an arrow).
  2. Under Environment, select Remix VM (Cancun) — this is an in-browser blockchain, no real ETH needed.
  3. Confirm that SimpleStorage is selected in the Contract dropdown.
  4. Click the orange Deploy button. The contract appears under "Deployed Contracts" at the bottom.
  5. Expand the deployed contract. You will see two buttons: store and retrieve.
  6. Type a number (e.g., 42) in the input box next to store, then click store.
  7. Click retrieve — the stored number appears below the button.
Reflection question: The store button is orange (state-changing transaction) and retrieve is blue (read-only call). Why do read-only calls cost no gas, but writes do?
3

Get Testnet ETH from the Sepolia Faucet

Tool: Sepolia Faucet
  1. Install the MetaMask browser extension if you have not already. Create or import a wallet.
  2. In MetaMask, click the network selector at the top and choose Sepolia Test Network. (Enable test networks in Settings → Advanced if not visible.)
  3. Copy your wallet address from MetaMask (click your account name at the top).
  4. Visit one of these Sepolia faucets:
  5. Paste your wallet address into the faucet and request test ETH. It should arrive within 30 seconds to 2 minutes.
  6. Confirm the balance appears in MetaMask on the Sepolia network.
Reflection question: Why do testnets exist? What would happen if developers had to pay real ETH for every contract deployment during development?
4

Deploy to Sepolia Testnet

Tool: Remix + MetaMask
  1. In Remix, go back to Deploy & Run Transactions.
  2. Under Environment, select Injected Provider - MetaMask. MetaMask will pop up asking for permission — click Connect.
  3. Confirm the network shown in Remix matches Sepolia (chain ID 11155111). If not, switch networks in MetaMask first.
  4. With SimpleStorage selected, click Deploy. MetaMask will show a transaction confirmation with a gas estimate.
  5. Click Confirm in MetaMask. Wait 15–30 seconds for the transaction to be mined.
  6. Once deployed, copy the contract address shown in Remix under "Deployed Contracts".
  7. Go to sepolia.etherscan.io and paste your contract address to see it on the block explorer.
Reflection question: Your contract address on Sepolia is permanent and publicly visible. What does this tell you about smart contract privacy? Are there ways to deploy private contracts?
5

Explore Useful Remix Plugins

Tool: Remix Plugin Manager
  1. Click the Plugin Manager icon in the left panel (looks like a plug). This lists all available Remix plugins.
  2. Find Solidity Unit Testing and click Activate. This adds a test runner to Remix.
  3. In the file explorer, create a new file SimpleStorage_test.sol in the tests/ folder and paste:
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "remix_tests.sol"; import "../contracts/SimpleStorage.sol"; contract SimpleStorageTest { SimpleStorage s; function beforeEach() public { s = new SimpleStorage(); } function testStoreAndRetrieve() public { s.store(99); Assert.equal(s.retrieve(), 99, "Retrieved value should be 99"); } }
  1. Open the Solidity Unit Testing panel and click Run. A passing test shows a green checkmark.
  2. Try the Gas Profiler plugin: activate it, run your contract functions, and observe gas costs reported per function call.
Reflection question: The unit test deploys a fresh contract in beforeEach(). Why is test isolation important in smart contract testing? What could go wrong if tests shared a single contract instance?
Home Lessons Quizzes Glossary © Joerg Osterrieder 2025-2026. All rights reserved.