The most comprehensive Solidity learning resource - 33 complete files covering 100% of professional development skills
This repository contains a complete, professional-grade Solidity reference covering everything from basic syntax to advanced optimization techniques. Each file is extensively commented in English with real-world examples, security warnings, and professional best practices.
Perfect for:
- ๐ Complete beginners starting their blockchain journey
- ๐ป Intermediate developers wanting to fill knowledge gaps
- ๐ Professional developers seeking advanced optimization techniques
- ๐จโ๐ซ Educators looking for comprehensive teaching materials
| # | File | Topics Covered | Level |
|---|---|---|---|
| 1 | DataTypes.sol | All Solidity data types with examples | Beginner |
| 2 | Functions.sol | Complete function reference | Beginner |
| 3 | Inheritance.sol | Inheritance, abstracts, interfaces | Intermediate |
| 4 | Libraries.sol | Library patterns and usage | Intermediate |
| 5 | ControlFlow.sol | Loops, conditionals, error handling | Beginner |
| 6 | Globals.sol | Global variables, units, time | Beginner |
| 7 | Operators.sol | All operators and expressions | Beginner |
| 8 | EtherTransfer.sol | transfer/send/call methods | Intermediate |
| 9 | DataLocation.sol | storage/memory/calldata | Intermediate |
| 10 | Cryptography.sol | Hashing, signatures, verification | Advanced |
| 11 | Assembly.sol | Inline assembly (Yul) | Advanced |
| 12 | Patterns.sol | Design patterns | Advanced |
| 13 | Security.sol | Security & vulnerabilities | Advanced |
| 14 | GasOptimization.sol | Gas optimization techniques | Advanced |
| 15 | Standards.sol | ERC20, ERC721, ERC1155, ERC2981 | Advanced |
| 16 | Imports.sol | Project organization | Intermediate |
| 17 | BestPractices.sol | โญ Bad vs Good code patterns (Senior) | Professional |
| 18 | Testing.sol | Foundry testing: unit, fuzz, invariant, fork, ERC-4337 | Professional |
| 19 | Deploy.sol | Foundry scripts: deploy, verify, multisig, CI/CD, CREATE2 | Professional |
| 20 | Integration.md | Frontend: ethers.js v6, viem v2, wagmi, ERC-4337 gasless, SIWE | Professional |
| 21 | DeFi.sol | AMM math, flash loans, oracles, liquidations, MEV, governance | Professional |
| 22 | L2.sol | L2 architecture, opcode diffs, bridges, CCIP, LayerZero, zkSync | Professional |
| 23 | FormalVerification.sol | SMTChecker, Certora CVL, Echidna, Halmos, Gambit, invariant design | Professional |
| 24 | Upgrades.sol | Transparent/UUPS/Beacon/Diamond proxies, ERC-7201, storage gaps, slashing, timelocks | Professional |
| 25 | EIP7702.sol | EOA delegation (Pectra), session keys, EIP-1271, sponsored txs, vs ERC-4337 | Expert |
| 26 | Intents.sol | Intent architecture, Dutch auction (UniswapX), solvers, ERC-7521, cross-chain (ERC-7683) | Expert |
| 27 | RWA.sol | Real World Assets, ERC-3643/T-REX, identity registry, compliance modules, DvP, dividends | Expert |
| 28 | ZKProofs.sol | Groth16/PLONK/STARK, ZK coprocessors (Axiom/SP1), nullifiers, ZK airdrop, recursive proofs | Expert |
| 29 | EigenLayer.sol | Restaking, AVS design, operator registration, slashing conditions, EigenPod, rewards | Expert |
| 30 | UniswapV4.sol | Singleton PoolManager, hooks architecture, dynamic fees, TWAMM, limit orders, custom curves | Expert |
| 31 | Governance.sol | Governor + TimelockController, proposal lifecycle, vetoGuardian, Snapshot hybrid, NFT voting | Expert |
| 32 | Tokenomics.sol | Vesting (cliff/linear), Merkle airdrop, bonding curves, staking rewards, veToken, buyback/burn | Expert |
| 33 | ModularAccounts.sol | ERC-7579 modular smart accounts, module types, session keys, ECDSA validator, ERC-4337 + EIP-7702 stack | Expert |
๐ See README_ROADMAP.md for detailed learning path
โก See QUICK_REFERENCE.md for commands, patterns & quick lookup
๐๏ธ See PROJECTS.md for hands-on practical projects
๐ง๐ท See BRASIL.md for Brazilian developers guide (Portuguese)
git clone https://github.com/wesleymassine/solidity-reference.git
cd solidity-referenceAll 32 .sol files compile with Foundry and are checked on every push:
forge build # compile all reference contracts
forge build --sizes # also report deployed bytecode sizesConfig lives in foundry.toml (solc 0.8.30,
via_ir, Cancun EVM). The files are self-contained โ no external dependencies to install.
Beginner Path (4 weeks):
DataTypes.sol โ Operators.sol โ ControlFlow.sol โ Functions.sol โ Globals.sol
Intermediate Path (4 weeks):
DataLocation.sol โ Inheritance.sol โ Libraries.sol โ EtherTransfer.sol โ Cryptography.sol
Advanced Path (4 weeks):
Assembly.sol โ Patterns.sol โ Security.sol โ GasOptimization.sol โ Standards.sol โ BestPractices.sol
Professional Path (3 weeks):
Testing.sol โ Deploy.sol โ Integration.md โ DeFi.sol โ L2.sol โ FormalVerification.sol
Expert Path (3 weeks โ 2025/2026 trends):
Upgrades.sol โ EIP7702.sol โ Intents.sol โ RWA.sol โ ZKProofs.sol โ EigenLayer.sol
โ UniswapV4.sol โ Governance.sol โ Tokenomics.sol โ ModularAccounts.sol
- Open files in VS Code, Remix, or your favorite editor
- Read comments thoroughly
- Run examples in Remix IDE
- Modify code and experiment
- Build small projects using each concept
This project now includes complete resources for Brazilian developers:
- ๐ผ Job boards for Web3 positions in Brazil
- ๐ค Portuguese-speaking communities
- ๐ฐ Bounty & freelancing opportunities
- ๐ Learning resources in Portuguese
- ๐ Brazilian hackathons calendar
See BRASIL.md for complete guide in Portuguese
- 33 complete reference files covering all Solidity concepts
- Over 10,000 lines of extensively commented code
- 150+ practical examples demonstrating best practices
- NEW: Bad vs Good code comparisons for professional development
- Vulnerable vs secure code comparisons
- Real-world attack vectors explained
- Prevention techniques for all common vulnerabilities
- Professional optimization techniques
- Before/after comparisons
- Gas cost analysis
- Production-ready code patterns
- Industry standard practices
- Real-world use cases
| Tool | Purpose | Link |
|---|---|---|
| Remix IDE | Quick testing & learning | remix.ethereum.org |
| Hardhat | Professional development | hardhat.org |
| Foundry | Fast Solidity testing | getfoundry.sh |
| VS Code | Code editing | code.visualstudio.com |
| Metamask | Wallet for testing | metamask.io |
| Tool | Purpose | Link |
|---|---|---|
| Slither | Static analysis & vulnerability detection | github.com/crytic/slither |
| Mythril | Security analysis tool | github.com/ConsenSys/mythril |
| Echidna | Fuzzing & property testing | github.com/crytic/echidna |
| Manticore | Symbolic execution tool | github.com/trailofbits/manticore |
| Tenderly | Real-time monitoring & debugging | tenderly.co |
| OpenZeppelin Defender | Security operations platform | openzeppelin.com/defender |
| Tool | Purpose | Link |
|---|---|---|
| hardhat-gas-reporter | Track gas usage in tests | npm: hardhat-gas-reporter |
| Foundry Gas Snapshots | Compare gas usage across versions | Built into Foundry |
| eth-gas-reporter | Mocha reporter for gas costs | npm: eth-gas-reporter |
- Solidity Docs - Official language documentation
- Ethereum.org Developer Docs - Ethereum fundamentals
- OpenZeppelin Docs - Security patterns & contracts
- Consensys Best Practices - Security guide
- CryptoZombies - Interactive Solidity tutorial
- Ethernaut - Security challenges (18 levels)
- Damn Vulnerable DeFi - DeFi security challenges
- Capture The Ether - Security CTF challenges
- Secureum Bootcamp - Advanced security training
- Patrick Collins - Smart Contract Developer - Free comprehensive course
- Smart Contract Programmer - Advanced topics
- Cyfrin Updraft - Free professional courses
- Alchemy University - Web3 development
- Week in Ethereum - Weekly updates
- Immunefi Blog - Security & bug bounties
- Trail of Bits Blog - Security research
- OpenZeppelin Blog - Best practices
- Consensys Diligence - Audit reports
- SWC Registry - Smart Contract Weakness Classification
- Rekt News - DeFi hack analysis
- Blockchain Threat Intelligence - Security newsletter
- Solodit - Audit report database
- Code4rena - Competitive audits
- ChainLink Documentation - Oracles & automation
- The Graph Docs - Indexing & querying
- IPFS Docs - Decentralized storage
- Uniswap V3 Book - DeFi protocol deep dive
- MEV Research - MEV & transaction ordering
- Trail of Bits - Security auditing
- OpenZeppelin - Smart contract audits
- Consensys Diligence - Security services
- ChainSecurity - Audits & tools
- Certora - Formal verification
- Ethereum Stack Exchange - Q&A platform
- r/ethdev - Reddit community
- Discord: Foundry - Foundry support
- Discord: Hardhat - Hardhat support
- Twitter/X - Follow: #Solidity #EthDev #SmartContracts
- Build Real Projects: Token, NFT marketplace, DAO, DeFi protocol
- Participate in Audits: Code4rena, Sherlock, Immunefi
- Read Audit Reports: Study how professionals find vulnerabilities
- Contribute to Open Source: OpenZeppelin, Aave, Uniswap
- Stay Updated: Follow Ethereum Improvement Proposals (EIPs)
- Network: Join Discord/Telegram groups, attend ETHGlobal hackathons
Data Types & Basics
- Boolean, integers, addresses
- Fixed-size arrays, dynamic arrays
- Strings, bytes
- Mappings, structs, enums
- Constants, immutables
Functions & Control Flow
- Function visibility (public, private, external, internal)
- State mutability (pure, view, payable)
- Modifiers, events, errors
- Loops, conditionals
- Error handling (require, assert, revert, try-catch)
Advanced Concepts
- Inheritance patterns
- Abstract contracts & interfaces
- Libraries & using for
- Storage, memory, calldata
- Inline assembly (Yul)
Security & Best Practices
- Reentrancy protection
- Access control patterns
- Front-running prevention
- Signature verification
- Common vulnerabilities
Gas Optimization
- Storage packing
- Calldata optimization
- Loop techniques
- Batch operations
- Assembly optimization
Standards & Patterns
- ERC20, ERC721, ERC1155
- Factory pattern
- Proxy/Upgradeable contracts
- Design patterns
- Project organization
After completing this reference, you will be able to:
- โ Write secure, production-ready smart contracts
- โ Implement all major token standards (ERC20, ERC721, ERC1155)
- โ Optimize contracts for minimal gas costs
- โ Prevent common security vulnerabilities
- โ Use advanced patterns (proxy, factory, etc.)
- โ Write comprehensive tests
- โ Deploy to mainnet confidently
- โ Perform code reviews
- โ Read and understand complex protocols
Contributions are welcome! If you find any issues or have suggestions:
- Fork the repository
- Create your feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add some improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenZeppelin for security patterns
- Solidity documentation team
- Ethereum developer community
- All contributors to this repository
- 33 Complete Files (NEW: ModularAccounts.sol (ERC-7579), Upgrades.sol, EIP7702.sol, Intents.sol, RWA.sol, ZKProofs.sol, EigenLayer.sol, UniswapV4.sol, Governance.sol, Tokenomics.sol)
- 22,000+ Lines of Code
- 150+ Examples
- 15+ Design Patterns
- 20+ Security Topics
- 50+ Gas Optimization Techniques
- 15+ Bad vs Good Pattern Comparisons
- 15+ Practical Projects (Beginner to Professional)
- ERC-4337 Account Abstraction (2024/2026)
- EIP-7702 EOA Delegation (Pectra 2025)
- Intent-based transactions (UniswapX / ERC-7521 / ERC-7683)
- Real World Assets (ERC-3643 T-REX, DvP settlement)
- ZK Proofs & Coprocessors (Groth16, SP1, Axiom)
- EigenLayer Restaking & AVS (operators, slashing, EigenPods)
- Foundry Testing: unit, fuzz, invariant, fork
- Brazilian Community Resources ๐ง๐ท
- Issues: GitHub Issues
- Discussions: GitHub Discussions
โญ If this repository helps you, please give it a star! โญ
Made with โค๏ธ for the Ethereum developer community ๐ง๐ท
โThis repo is a learning/reference resource (not audited production contracts).