This course is for experienced programmers. If you don’t already know how to code, we suggest picking up Python or JavaScript first then coming back.
If you are new to Solidity, start at the beginning.
However, Solidity developers of all levels can benefit from the resources here — in the later sections discuss very advanced topics such as how Tornado Cash works. We also have the only protocol walkthrough of the Compound V3 codebase.
Other bootcamps charge hundreds, sometimes thousands of dollars just to see their curriculum. At RareSkills, we believe the entire community benefits when high quality education is freely available. And by free we mean truly free — not gated with an email we can monetize later.
The work is truly a public good.
We do hope you will sign up for our bootcamp though! You’ll get time with instructors and a community who have secured billions of dollars in TLV (total locked value).
Although this is not a smart contract security course per se, smart contract security researchers regularly refer to the resources here. Our philosophy is that security comes from deeply understanding what you are doing.
Therefore, we don’t create a large list of topics just for the sake of it. We deeply examine non-obvious issues that even experienced Solidity engineers sometimes miss; having taught many through our Solidity Bootcamp we know where the knowledge gaps frequently lie.
Deep understanding should be the expectation for anyone writing code than manages other people’s crypto. As such, our tutorials prioritize generating strong mental models even if it takes more effort to do so.
Finally, we encourage you to compare our tutorials with others on the same subject (and those generated by an AI chatbot).
We are sure you will be impressed at the level of depth, comprehensiveness, and clarity our articles achieve.
No email required! This is for experienced programmers who want to get to the point quickly and immediately practice the information they just gained in a highly optimized topic order. We emphasize the unexpected and unusual aspects of the Solidity language while glossing over things we can reasonably assume to be obvious to a competent developer. Aside from an occasional humorous remark, we’ve made the tutorials as short as possible (but not shorter). Although this is a solidity beginner tutorial, it is intended for experienced coders.
There is a distinction between knowing a language, and knowing a domain. Knowing Python doesn’t make you a data scientist, knowing Javascript doesn’t make you a frontend developer, and knowing Kotlin does not make you an Android developer. Similarly, knowing Solidity does not make you an Ethereum smart contract developer. However, Solidity is a prerequisite for developing smart contracts.
Setting up Remix
Solidity is a typed language
The Most popular development framework in 2024
A quick overview of doing math in Solidity
A quick lesson on conditional operators
Syntax for iterative operators
Data types of unbounded size
2D and 3D data types
Using a “database in Web3”
Persistent lists
Persistent lists
Persistent hash maps with multiple levels
Determining which wallet is calling the smart contract
Configuring the smart contract on deployment
Protecting smart contracts from malicious parameters
An introduction to the most fundamental building block of DeFi
Batching values together
Solidity’s binary encoding format of choice
Learn how composability works in Solidity
Your first DeFi app
Transferring Ether with function calls
How smart contract can receive ETH transactions
What is the date and time today?
Leaving an audit trail in smart contracts
Organizing code in large smart contracts
Add re-useable functionality to Solidity function
Write-once variables
How to avoid “magic numbers”
Share your NFT with the world
Open source the code of an NFT
Convenient keywords for dealing with large numbers
How to keep data in groups
Concatenation, UTF-8 encoding, and more
How to write professional unit tests in Foundry
At this point, you now have enough knowledge to build smart contract projects end to end. If you are new to Solidity we strongly recommend you build these projects, not skip them. You can only learn so much by reading tutorials, some knowledge can only be acquired with practice.
The purpose of this article is not to rehash the official Solidity Style Guide, which you should read.
Everyone makes mistakes, but some mistakes are more common than others.
You now have enough knowledge to build any of the following projects. Knowledge comes by study, but skill comes with practice.
If you already know some Solidity but are ready to move to the next level, this is the section to start.
This article describes three methods in Solidity for determining if an address is a smart contract:
The function selector is a 4 byte id that Solidity uses to identify functions under the hood.
ERC721 (or ERC-721) is the most widely used Ethereum standard for nonfungible tokens.
The ERC-1155 token can hold multiple fungible and non-fungible tokens in a single contract.
ERC4626 is a tokenized vault standard that uses ERC20 tokens to represent shares of some other asset.
An Enumerable ERC721 is an ERC721 with added functionality that enables a smart contract to list all the NFTs an address owns.
ERC-1363 enables a smart contract to detect and respond to an incoming transfer of tokens.
The uint256 max value can be obtained with type(uint256).max
Solidity signed integers enable using negative numbers in a smart contract. This article documents how they are used at the EVM level.
Staticcall is like a regular Ethereum call except that it reverts if a state change happens.
The onlyOwner modifier is probably one of the most common patterns in Solidity.
To test an internal solidity function, create a child contract that inherits from the contract being tested.
Solidity events are the closest thing to a “print” or “console.log” statement in Ethereum.
The purpose of this article is to describe the behavior of the solidity gasleft() function and its uses.
Reentrancy can only happen when your smart contract calls another smart contract via function call or sending ether.
Randomness is tricky on the blockchain because the blockchain is deterministic, but randomness requires non-determinism (otherwise it becomes predictable).
Some building blocks and design patterns occur so frequently in DeFi applications that they are best studied directly. Don’t just read these tutorials, practice the problems at the end.
The MasterChef and Synthetix staking algorithms distribute a fixed reward pool among stakers according to their time-weighted contributions to a pool.
A fixed-point number is an integer that stores only the numerator of a fraction — while the denominator is implied.
Flash loans are loans between smart contracts that must be repaid in the same transaction.
Chainlink price oracles are smart contracts with public view functions that return the price of a particular asset denominated in USD.
The intuitive way to track lender deposits is to record the amount of USDC they deposited and the time they deposited. Compound V3 does not do this.
Uniswap V2 is the most forked protocol in DeFi and has inspired several more. The Uniswap V2 Book is a line-by-line examination of the protocol.
Uniswap is a DeFi app that enables traders to swap one token for another in a trustless manner.
his article explains how to determine the price settlement of a trading pair in an Automated Market Maker (AMM).
Uniswap V2’s swap function is cleverly designed, but many devs find its logic counterintuitive the first time they encounter it.
The lifecycle of Uniswap V2 is someone mints LP tokens (supplies liquidity, i.e. tokens to the pool) for the first time.
Uniswap V2 was designed to collect 1/6th of the swap fees to the protocol. Since a swap fee is 0.3%, 1/6th of that is 0.05%, so 0.05% of every trade would go to the protocol.
Suppose we have 1 Ether and 2,000 USDC in a pool. This implies that the price of Ether is 2,000 USDC.
The Uniswap V2 Library simplifies some interactions with pair contracts and is used heavily by the Router contracts.
The Router contracts provide a user-facing smart contract for safely minting and burning LP tokens (adding and removing liquidity)
It’s very educational to rebuild Uniswap v2 from scratch using modern Solidity (or Huff if you really want to do it in hard mode).
ABI encoding is the data format used for making function calls to smart contracts. It is also how smart contracts encode data when making calls to other smart contracts.
How storage variables work under the hood
A contract in Solidity can call other contracts via two methods: through the contract interface, which is considered a high-level call, or by using the call method, which is a low-level approach.
This article explains how delegatecall works in detail. The Ethereum Virtual Machine (EVM) offers four opcodes for making calls between contracts:
EIP 1967 is a standard for where to store information that proxy contracts need to execute.
ERC-7201 (formerly EIP-7201) is a standard for grouping storage variables together by a common identifier called a namespace.
The Transparent Upgradeable Proxy is a design pattern for upgrading a proxy while eliminating the possibility of a function selector clash.
EIP 1967 is a standard for where to store information that proxy contracts need to execute.
EIP-1167, which is also referred to as the minimal proxy contract, is a commonly used solidity pattern for cheaply creating proxy clones.
The minimal proxy standard allows us to parameterize the creation of the clone, but this requires an extra initialization transaction.
The nodelegatecall modifier prevents delegatecalls from being sent to a contract.
ERC20 Snapshot solves the problem of double voting.
ERC20 Votes does not actually handle conducting the poll, it’s still a regular ERC20 token with snapshot and delegated voting abilities.
The pattern of governance many DeFi applications follows is heavily inspired by Compound Finance’s implementation.
Compound V2 is the most forked lending protocol, but it is no longer used, so our walkthrough focuses on Compound V3. Nearly every modern lending protocol takes inspiration from Compound, so if you completely understand the codebase, you will easily be able to understand other DeFi lending protocols.
Compound is one of the most significant lending protocols in DeFi, having inspired the design of nearly every lending protocol on several blockchains.
The Compound V3 protocol measures interest on the scale of seconds. The Compound V3 frontend scales the number up to years for human friendliness.
The intuitive way to track lender deposits is to record the amount of USDC they deposited and the time they deposited.
The Compound V3 contract behaves like a rebasing ERC 20 token. A rebasing token is a token which has an algorithmically adjusted supply rather than a fixed one.
In this chapter we will examine the following topics about Compound V3: collateral valuation
Compound issues rewards in COMP tokens to lenders and borrowers in proportion to their share of the a market’s lending and borrowing.
The Uniswap V2 Library simplifies some interactions with pair contracts and is used heavily by the Router contracts.
The Router contracts provide a user-facing smart contract for safely minting and burning LP tokens (adding and removing liquidity)
The bulker contracts in Compound V3 are multicall-like contracts for batching several transactions.
The OG gas optimization course.
An Ethereum access list transaction enables saving gas on cross-contract calls by declaring in advance which contract and storage slots will be accessed.
Over 80 gas optimization tips and tricks.
Our Yul Course on Udemy
When solidity generates the bytecode for the smart contract to be deployed, it appends metadata about the compilation at the end of the bytecode.
Smart contract creation cost can be anywhere from $10 to $2,000 assuming Ether costs between $1,500 to $2,000.
This article explains what happens at the bytecode level when an Ethereum smart contract is constructed and how the constructor arguments are interpreted.
EIP-150, or Ethereum Improvement Proposal 150, is a protocol upgrade for the Ethereum blockchain.
Mistakes in smart contracts can be extremely costly. Therefore, employing as many tools as possible will maximize your chances of success against bugs and hackers.
In this article, we will discuss invariants and how to perform an invariant test on solidity smart contracts using foundry test suites.
Mutation testing is a method to check the quality of the test suite by intentionally introducing bugs into the code and ensuring the tests catch the bug.
The second preimage attack in Merkle trees can happen when an intermediate node in a merkle tree is presented as a leaf.
Ethereum precompiles behave like smart contracts built into the Ethereum protocol. The nine precompiles live in addresses 0x01 to 0x09.
Creating a contract that gives certain addresses permissions goes by several names: airdrops, presale, whitelist, allowlist, and so forth.
Tornado cash is a cryptocurrency smart contract mixer that enables users to deposit crypto with one address and withdraw with another wallet.