SolidityIn

Learn Solidity by reading and writing real contracts.

40 lessons in 17 modules. Edit and compile code right in the page. Free, with progress saved in your browser.

Start lesson 1
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Counter {
    uint256 public count;

    function increment() public {
        count += 1;
    }
    function decrement() public {
        require(count > 0, "Already zero");
        count -= 1;
    }
    function reset() public {
        count = 0;
    }
}

Course modules

Basics

3 lessons: Your first contract, Types and variables, Arrays and loops

Functions

3 lessons: Functions and visibility, Mappings and structs, Storage, memory and calldata

Control

3 lessons: Modifiers and require, Events, Custom errors

Ether

3 lessons: Payable and msg.value, Sending ETH safely, Receive and fallback functions

Security

3 lessons: Common vulnerabilities, Access control with roles, Gas optimization

Tokens

3 lessons: Building an ERC-20 token, NFTs with ERC-721, Using OpenZeppelin

Patterns

2 lessons: State machines, Factory contracts

EVM

2 lessons: Storage layout and slots, ABI encoding and function selectors

DeFi

2 lessons: Building a simple AMM, Staking and rewards

Practice

2 lessons: Inheritance and interfaces, Deploying to a testnet

Testing

2 lessons: Testing with Foundry, Testing reverts, events and cheatcodes

Frontends

2 lessons: Connecting a wallet with ethers.js, Sending transactions and listening to events

Advanced

2 lessons: Proxies and upgradeability, Oracles and price feeds

Layer 2

2 lessons: How rollups work, Deploying to Layer 2s and bridges

Account Abstraction

2 lessons: Smart accounts and account abstraction, Paymasters and sponsored gas

Case Studies

2 lessons: The DAO hack and reentrancy, Oracle manipulation and flash loans

Projects

2 lessons: Build a crowdfunding contract, Build a voting contract