Skip to content
Tutorials Center
My learning

Topics

Solidity and Ethereum Tutorial

Learn Solidity and Ethereum step by step: 47 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 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.
  2. 2 Smart Contracts: Features, Uses and Limits Understand smart contracts: where the idea came from, their key features, real-world applications such as DAOs, DeFi and supply chains, and their limits, with runnable models.
  3. 3 How a Smart Contract Runs Follow a smart contract from deployment to execution: addresses, calls versus transactions, storage versus memory, the ABI and why contracts are deterministic.
  4. 4 Your Solidity Toolbox A tour of the tools behind Solidity work: the solc compiler, Remix, Hardhat, Foundry, ethers.js and viem, wallets, local nodes and testnets, with a runnable loop.
  5. 5 Your First Contract Write and understand your first Solidity contract: license line, pragma, state variables, functions, view, plus how to deploy it in Remix and a JS twin.

Language Basics

  1. 6 Comments, NatSpec and the Style Guide Write clear Solidity: single-line, multi-line and NatSpec comments, the SPDX line, the official layout and naming rules, with a runnable NatSpec reader and style checker.
  2. 7 Value Types Learn Solidity's value types: bool, uint and int sizes, address and address payable, fixed bytes, enums, literals and default values, with BigInt stand-ins.
  3. 8 Integers, Overflow and Checked Math How Solidity 0.8 checks arithmetic, what a panic is, when to use unchecked, how division rounds and how wad and ray fixed-point math works, with BigInt demos.
  4. 9 Operators, Ether Units and Time Units Learn every Solidity operator (arithmetic, comparison, logical, bitwise, assignment), the ** and % rules, and wei, gwei, ether and time units, with BigInt demos.
  5. 10 Strings, Bytes, Arrays and Structs Learn Solidity reference types: dynamic and fixed arrays, string versus bytes, structs, and how memory, storage and calldata copies differ.
  6. 11 Mappings Learn Solidity mappings: key-value storage, default values, nested mappings, why you cannot loop over them, and the pattern for tracking keys.
  7. 12 Functions and Visibility Learn Solidity functions: public, external, internal and private visibility, view and pure, multiple and named returns, and function overloading.
  8. 13 Control Flow, require, revert and Custom Errors Learn Solidity control flow and error handling: loops and their gas cost, require, assert, revert, custom errors, try/catch and panic codes.
  9. 14 msg.sender, msg.value and Global Variables Learn Solidity's built-in globals: msg.sender, msg.value, msg.data, block.timestamp, block.number, chain ID, and why tx.origin is dangerous.

Contract Structure

  1. 15 Constructors, Constants and Immutables Learn how Solidity constructors set up a contract at deployment, and how constant and immutable variables save gas compared to storage.
  2. 16 Events and Logs Learn Solidity events: emit, indexed parameters, how logs are stored and filtered, listening off-chain, and when to use events instead of storage.
  3. 17 Modifiers and Access Control Write Solidity modifiers, build onlyOwner, roles, two-step ownership transfer and a pause switch, and see the guard pattern in a runnable JavaScript stand-in.
  4. 18 Sending and Receiving Ether Learn how Solidity contracts receive and send ether: payable, receive, fallback, call vs transfer vs send, the withdrawal pattern and selfdestruct changes.
  5. 19 Storage, Memory and Calldata Understand Solidity data locations: storage slots and packing, memory, calldata, how costs differ, copy rules and stack depth, with a slot-packing calculator.

Object-Oriented Solidity

  1. 20 Inheritance and Overriding Learn Solidity inheritance: is, virtual and override, super, constructor arguments, multiple inheritance linearization and abstract contracts, with a runnable C3 model.
  2. 21 Encapsulation, Polymorphism and Inheritance Shapes Hide state behind validated functions, overload and override functions, call different contracts through one interface, and use multi-level and hierarchical inheritance.
  3. 22 Interfaces and Libraries Learn Solidity interfaces and libraries: calling other contracts through an interface, internal vs external libraries, using for, and a duck-typed JS stand-in.
  4. 23 ABI Encoding and Low-Level Calls Learn how function selectors and abi.encode work, why encodePacked can collide, and how call, staticcall and delegatecall differ, with runnable stand-ins.
  5. 24 Inline Assembly and Yul Learn Solidity inline assembly with Yul: variables, built-in opcodes, if, switch and for, memory and the free memory pointer, storage slots, and why unchecked math is risky.
  6. 25 Proxies and Upgradeable Contracts Learn how delegatecall proxies upgrade contracts, why storage layout clashes break them, transparent vs UUPS proxies, initializers and the risks.

Tokens and Standards

  1. 26 Building an ERC-20 Token Build an ERC-20 token step by step: balances, transfer, approve, transferFrom, events, decimals and the allowance race, with a runnable stand-in.
  2. 27 ERC-721 NFTs Understand ERC-721 non-fungible tokens: ownership per token id, approvals, safeTransferFrom receivers, tokenURI and off-chain metadata, with a runnable registry.
  3. 28 ERC-1155, ERC-4626 and Friends Learn the multi-token standard ERC-1155, the ERC-4626 vault share standard, ERC-165 interface detection and the permit idea, with runnable stand-ins.
  4. 29 Using OpenZeppelin Learn why to reuse audited code and how to use OpenZeppelin's Ownable, AccessControl, ReentrancyGuard, Pausable and SafeERC20, with runnable pattern stand-ins.

Security

  1. 30 Common Vulnerabilities Learn the classic smart contract bugs: reentrancy, tx.origin, unchecked calls, front-running, denial of service, weak randomness and signature replay.
  2. 31 Reentrancy Step by Step Follow a DAO-style reentrancy attack step by step, then fix it with checks-effects-interactions and reentrancy guards, including cross-function and read-only cases.
  3. 32 Gas Costs and Optimization Understand what makes Solidity transactions expensive: storage writes, packing, calldata, loops and custom errors, and measure savings with a gas-counting model.
  4. 33 Testing Contracts Learn how to test smart contracts: unit tests, fuzzing, invariants, forking and coverage, with Foundry and Hardhat examples and a runnable fuzzing stand-in.
  5. 34 Audits, Tools and Best Practices Learn how contracts are reviewed and kept safe: static analysis such as Slither, fuzzing, formal checks, audits, multisigs, timelocks and deployment checklists.

Working With Contracts From Outside

  1. 35 Talking to Contracts with JavaScript Learn how JavaScript connects to Ethereum: providers, signers, the ABI, reading and writing contracts and listening to events, with ethers.js and viem.
  2. 36 Truffle, Ganache and web3.js: The Classic Toolchain Set up and read the classic Truffle, Ganache and web3.js workflow: init, compile, migrate, networks, HDWalletProvider, call versus send, and what replaced it today.
  3. 37 Deploying to Testnet and Mainnet Deploy a Solidity contract to a testnet and mainnet: networks, faucets, constructor arguments, source verification on explorers and key safety, with a stand-in script.
  4. 38 Oracles, Randomness and Off-Chain Data Learn why smart contracts need oracles, how price feeds get manipulated, why block data is bad randomness, and how commit-reveal and signed messages work.

Projects

  1. 39 Project: A Voting Contract Build a Solidity voting contract with proposals, voter registration, one vote per address, a deadline and a tally, then test the same logic in a JavaScript stand-in.
  2. 40 Project: Crowdfunding With Refunds Build an all-or-nothing crowdfunding contract in Solidity with a goal, a deadline, a state machine, creator withdrawal and pull-based refunds, plus a JavaScript stand-in.
  3. 41 Project: A Token and Simple Sale Build an ERC-20 token and a sale contract that sells it for ether with a price, a per-buyer cap, a deadline and owner withdrawal, then test a JavaScript stand-in.
  4. 42 Project: Escrow and English Auction Build two classic contracts: an escrow with a buyer, seller and arbiter, and an English auction with timed bids and pull refunds, and test them in a JavaScript stand-in.
  5. 43 Project: A Multisig Wallet Build a multisignature wallet in Solidity: owners, proposals, confirmations and execution through low-level calls, plus a runnable JavaScript stand-in.
  6. 44 Project: On-Chain To-Do List, Employee Registry and Wallet Build three classic contracts: a to-do list with create, read, update and delete, an employee registry with access control, and a personal wallet, then connect them to a front end.

Practice and Review

  1. 45 Practice Exercises With Solutions Fifteen graded Solidity exercises on types, mappings, errors, tokens and security, each with a runnable JavaScript stand-in solution you can edit.
  2. 46 Solidity Interview Questions Prepare for a Solidity interview: short answers on the language, gas, security, token standards and design, with runnable JavaScript demos for the tricky ones.
  3. 47 Solidity Cheat Sheet A one-page Solidity cheat sheet: types, data locations, visibility, globals, panic codes, patterns, token standards and a security checklist, with live helpers.