Solidity

Solidity is by far the most popular language to write smart contracts at the moment as the EVM is the most widely adopted virtual machine out there. Not only is it used in Ethereum’s execution layer, but many alt L1s and L2s on Ethereum use the EVM as their virtual machine since there’s a fairly mature development ecosystem. In order to first learn Solidity, we’ll go over a few simple courses that explain the principles of the language, and as we progress further we will talk about design patterns, testing, security, oracles, and more.

One of the best ways to learn basic Solidity is the playlist from Smart Contract Programmer on YouTube. This one is a bit better as it covers Solidity 0.8.0 which is a fairly recent version. Also go through the Solidity-by-example smart contracts which teach you the basics of Solidity, some common security vulnerabilities and the implementations of some popular patterns. Another great YouTube playlist for learning Solidity is the 32-hour course from Patrick Collins, however I’d recommend not learning Hardhat, and instead learning Foundry and other more advanced security tooling like echidna or slither, formal verifaction tooling, etc.

CryptoZombies is an interactive web application that teaches you the basics of Solidity through a fun development game. It teaches you how to create a contract, the data types that Solidity supports, how to write methods, how to manage objects, events, inheritance, memory management, interfaces, modifiers, and more. Disclaimer: The version of Solidity used in CryptoZombies is 0.5-0.6 which may differ in some things with current versions of Solidity.

After we finish the course with the basics, we’ll move on to building small projects implementing various different protocols, applications, and cryptographic primitives through the use of the scaffold-eth challenge that appear in this thread. Scaffold-eth is a web3 development template built by Austin Griffith and open-source contributors which abstracts the backend of your app and creates a front-end interface for interacting with the smart contracts that you write. We will start with the Ethereum Speed Run challenges in the thread mentioned above, and continue with building more complex applications like a signature-based multisig, an app that uploads images to IPFS, and more.

Now that you’ve been writing more and more complex smart contracts it is a good idea to start looking at other people’s code to get a feel for how they implement different features, how they structure code, what designs and patterns they use, how they optimize for gas, and a lot more.

There are many techniques that you’ll be picking up along on your journey in order to make your contracts more resource-effective and gas-optimized so that your users don’t need to spend as much money for using your applications.

A good example of well-made smart contracts at the intermediate level are Miguel Piedrafita’s lil-web3 contracts. They are simple implementations of popular protocols and applications. They also have tests attached to them which are written using Foundry, which we will cover shortly. Take a look at how comments are written, how events and errors are used, how it is structured, gas minimization techniques he employs, try to understand the design of the protocol implementation, etc. Trying to implement your own versions of well-known applications and protocols is a great way to improve at Solidity as you’ll learn a lot about the development process that you’ll go through once you are writing production code at a company or DAO.

Another great resource is the official Solidity blog, where the developer team behind Solidity posts about updates to the language (new versions and changelogs), security alerts, events like Solidity Summit or contests like Underhanded Solidity.

I recommend checking out the presentations from Solidity Summit, a Solidity event that took place during the ETHAmsterdam conference and the Underhanded Solidity submissions where contestasts had to find clever ways of writing seemingly secure code that includes subtle vulnerabilites.

Community compilation of Solidity resources: awesome-solidity.

Threads that talk about getting really good at Solidity

Once you’ve gone through all of the above the best you can do to learn Advanced Solidity is to see what the best codebases look like. Look at how they structure their projects, what gas optimizations they use, what Solidity patterns they employ, how they do tests, how they create interfaces, how they handle events and errors, what libraries/dependencies do they use (if any), etc.

Examples of great codebases: