Home / Solidity
Solidity
Solidity step-up: multi-inheritance, libraries, custom errors, reentrancy guards, gas packing, Foundry fuzz tests, ERC20/721/1155 from scratch, proxies, DeFi pools and staking — all test-proven.
Beginner Solidity teaches a contract that holds a number and pays ether back out. Intermediate Solidity teaches a contract that survives strangers. The lessons here take the pieces you already know — inheritance, events, modifiers, payable functions — and push each one until it meets the problems real contracts actually face: a caller that calls back in the middle of a payment, a token that must answer to many holders at once, a pool that prices a swap from its own balances.
Course contents
Work top to bottom — the sidebar is the course. Topics later in the list assume the ones before them.
Solidity Intermediate Introduction
Intermediate · ⏱ 3 min · standalone lesson
Inheritance in Depth
- Solidity Multiple Inheritance
- Solidity Linearization
- Solidity Abstract Contracts
- Solidity Override Rules
- Solidity Inheritance Constructors
Interfaces and Libraries
Start: Solidity Interfaces in Depth ❯Custom Errors
Start: Solidity Custom Errors ❯Security in Depth
- Solidity Reentrancy
- Solidity Reentrancy Guard
- Solidity Checks Effects Interactions
- Solidity Role Based Access
- Solidity Pull Payments
- Solidity Delegatecall Dangers
- Solidity Tx Origin Pitfall
Gas Optimization
- Solidity Storage Packing
- Solidity Calldata vs Memory
- Solidity Loop Gas Patterns
- Solidity Caching Storage Reads
- Solidity Unchecked Math
Testing in Depth
- Solidity Foundry Unit Tests
- Solidity Fuzz Testing
- Solidity Invariant Testing
- Solidity Testing Reverts Events
- Solidity Cheatcodes in Depth
ERC Standards in Depth
- Solidity ERC20 Mechanics
- Solidity ERC20 Allowances
- Solidity ERC20 Extensions
- Solidity ERC721 Mechanics
- Solidity ERC721 Metadata
- Solidity ERC1155 Mechanics
- Solidity Token Standards Compared
Upgradeability
Start: Solidity Proxy Concepts ❯DeFi Patterns
- Solidity Liquidity Pools
- Solidity Token Swaps
- Solidity Staking Mechanics
- Solidity Lending Concepts
- Solidity Price Oracles
Solidity Project: Staking Token
Intermediate · ⏱ 6 min · standalone lesson
Solidity Project: DAO Voting
Intermediate · ⏱ 6 min · standalone lesson
Solidity Project: Multisig Wallet
Intermediate · ⏱ 7 min · standalone lesson
Learn Solidity Intermediate
A beginner contract trusts its callers. It checks the owner, moves a balance, and assumes the call finishes before anything else happens. An intermediate contract drops that trust. Every outside call is a door the caller can walk back through, every shared balance is a number two people can argue about, and every upgrade is a chance to read the wrong storage slot. This course is about building contracts that stay correct when callers stop cooperating.
The forty-eight lessons fall into nine groups plus three projects. Inheritance grows from one parent to several, with the ordering rule that decides which version of a function runs. Libraries and custom errors replace repeated code and vague failure messages. Security takes the longest look, because a payment bug on a chain cannot be undone with an apology and a refund script.
Later groups turn to the contracts people actually deploy. Token standards spell out how a coin, a unique item, and a multi-type collection each behave, so wallets and markets can speak to them without special cases. Proxies separate a contract’s stored data from its code, so the code can change while the balances stay put. The final teaching group sketches decentralised finance in miniature: pools, swaps, staking rewards, loans against collateral, and price feeds — all with toy tokens on a practice chain, never real funds.
What you will learn
Each item below is a skill you practise on a contract small enough to read in one sitting:
- Inherit from several parents at once, and predict which function runs when two parents define the same name.
- Write abstract contracts that lay down a shape for children to fill in, and pass arguments up through base constructors.
- Move shared logic into libraries, attach it to types with using for, and tell when a library beats a second contract.
- Replace reason strings with custom errors that carry the failing values, and catch outside failures with try and catch.
- Spot a reentrancy hole, close it with a guard or by settling state before the outside call, and prefer pull payments over pushing ether to a crowd.
- Hand out permissions by role instead of by single owner, and recognise why tx.origin must never stand in for msg.sender.
- Pack storage slots, pass read-only arrays as calldata, cache repeated reads, and skip overflow checks only where the code makes overflow impossible.
- Test like a contract team does: unit tests, fuzzed inputs, invariants that must survive every call sequence, and cheatcodes that bend sender, balance and time.
- Build the three token standards from scratch: a coin with allowances, a unique-item token with per-item metadata, and a multi-type token with batch balances.
- Split a contract into a proxy that holds state and a logic contract that can be swapped, and keep the storage layout safe across the swap.
- Sketch decentralised finance in miniature: a constant-product pool, a swap with a minimum return, staking that pays by the second, a loan capped by collateral, and a mock price feed.
Who this Solidity Intermediate course is for
This course expects the beginner course behind you. It uses state variables, mappings, inheritance at a first look, events and payable functions without stopping to explain them again, and it assumes you have written a small contract and watched its tests pass.
It suits a reader who has finished the beginner lessons and felt the gap: the contracts worked, but you could not yet say why a payment function was safe, or how a token contract answers a wallet it has never met. If that gap sounds familiar, the security and token groups are the payoff for the first half of the course.
The estimates printed on the forty-eight lessons add up to 169 minutes. Most readers take a second week for it, because the security lessons repay a slow read: try to spot each hole before the lesson names it, and attempt every exercise before looking at the answer.
How this course works
Start at the first lesson and move down. The contents list is a route rather than a menu: a guard pattern only makes sense after the attack it stops, and the staking project leans on the token, pool and time lessons that precede it.
No example here is a sketch. Every contract below passed through the real Solidity compiler before publication, and tests then called its functions, attacked it, or drained it, and checked the answers. The output printed below a contract is the write-up of those tests passing, so a claim like “the second withdrawal reverts” is a behaviour that was measured, not asserted.
A real run needs a chain of its own, so the Try-it box never claims to be one. It prints the write-up of the tests run on the lesson contract, and the Remix editor that every lesson links to opens in a browser tab when you want to deploy a token or a pool yourself and prod it.
Progress lives in your browser. Lessons you finish gain a mark in the contents list, and the course home offers to pick up where you left off when you return.
Frequently asked questions
Is this Solidity Intermediate course free?
Yes. All forty-eight lessons are free to read, no payment asked, and you start by opening the first lesson — no account step stands between you and the code.
Do I need the beginner course first?
Yes, in practice. The lessons use state variables, mappings, inheritance, events and payable functions without explaining them again, so a reader who skips the beginner course will meet unexplained ideas in the first group. The beginner course is the prerequisite, not a suggestion.
What is a reentrancy attack?
It is an attack where a contract sends ether to a caller before updating its own records, and the caller calls back into the same function while the old balance still stands. The contract pays twice because its books were not settled before the outside call. The security group shows the attack, then two ways to close it.
Do the lessons use real ether or a real chain?
No. Every contract runs on a local practice chain inside the test setup, with toy tokens and made-up accounts. Nothing here touches real funds, a real exchange, or a live network, and nothing you deploy from a lesson page should carry value.
How much time does this Solidity Intermediate course take?
Reading and practice across the lessons add up to 169 minutes. The security group and the three projects deserve a slower pass, so a careful reader usually spends a second week on the course rather than rushing it in one sitting.
What should I learn after Solidity Intermediate?
The usual next step is the web side, since visitors meet contracts through pages. JavaScript drives those pages and the wallet prompts inside them, so it pairs naturally with contract work. System design is the other honest next step, for the day a contract sits at the heart of a product with servers behind it.
Next steps
- JavaScript Beginner ❯ — The language of web pages, and the bridge a visitor crosses to reach a contract’s front door. Clicks, forms and wallet prompts all run on JavaScript.
- Python Beginner ❯ — A friendly language for scripts and automation. Its short programs are handy for probing contract ideas and for shaping data away from the chain.
- System Design Beginner ❯ — Planning for systems bigger than one contract: where data lives, how load grows, and which trade-offs hurt least. It matters once a contract sits inside a product with servers and many readers.