Process
Learning Solidity for Engineers
Last updated:
January 3, 2022

This guide presents a possible path to quickly learn Solidity targeted at web2 engineers that may be familiar with back-end, front-end, mobile, scientific or other general types of development. By the end of this guide you will have built a complete smart contract, deployed and tested it and will be ready to develop on Ethereum or study more advanced topics.

What is difficult about learning Solidity

First, why do we even need a guide? Why can't we just jump in and learn Solidity just like any other programming language? For example, if you already knew Python, you could learn some Node.js pretty quickly by working on a real project and referring to https://hyperpolyglot.org/scripting. It turns out that Ethereum presents its own unique challenges:

  • Unclear what to work on. In traditional programming, you can start with “Hello World” and move on quickly to a practical project (compiler, scraper, trading bot, etc.), it’s difficult to estimate what is an easy starting project in smart contracts if you have never developed any
  • The underlying model is unintuitive. Since you are targeting Ethereum and the Ethereum Virtual Machine (EVM), things work differently. Solidity in some ways behaves like Python (you can build complex logic) and in other ways behaves like SQL (you can only execute it by sending transactions to a database)
  • The tooling is not great. While tooling has improved significantly in recent years, most tools require an expert understanding of the EVM to be truly productive in and error messages can be very difficult to parse due to the large number of layers in the stack (underlying blockchain network, node hosting tool, smart contract framework)

Approach

This is inevitably going to be a very opinionated approach, but there are a few principles we have tried to adopt to overcome the above challenges:

  • Focus on creating short feedback loops. This helps with building an understanding of the different layers.
  • Tackle smaller tasks first. Don't start with a lending protocol, start by doing small functions, then move on to simple tokens, etc.
  • End-to-end over depth. Our focus is to quickly learn the full stack of tooling required to deploy a simple smart contract rather than widely exploring all functionality (e.g., strings, complex deployment, arrays).
  • Learn to read the manual. Knowing where to look for help around each layer is helpful.

Lastly, I have not focused on tutorial curation and it is encouraged that the reader looks for other beginner tutorials that they enjoy and that guide through the different steps.

Know where to ask for help

Follow our guide on How to Get Unstuck with Ethereum if you run into any issues. Be OK with getting stuck for longer than doing web2 development. web3 has a high barrier to entry but is very rewarding when you learn it.

Learning Solidity, step-by-step

Use it (~2 days)

First priority is to use some simple smart contracts: make a trade on Matcha, lend some money on Compound, etc. You can refer to https://newsletter.banklesshq.com/ for some interesting things to do. Learn how to use Metamask.

Get your hands dirty (~1 day)

Start by doing crypto zombies. This is still the most interactive tutorial available: https://cryptozombies.io/.

Read about Ethereum’s implementation in the Whitepaper (~1 day)

One way to look at Ethereum is as a shared database for programs and their data. You don't need to understand the details at this stage but the whitepaper will help by building some intuition on what a smart contract is and how it is stored. https://ethereum.org/en/whitepaper/

You can also refer to the first section of this guide for a more visual explanation: https://takenobu-hs.github.io/downloads/ethereum_evm_illustrated.pdf.

Remix IDE: Write your first smart contract (~1-3 days)

Find any good smart contract tutorial and start learning using the Remix IDE. https://remix.ethereum.org/. Learn to use all the additional functions like debugging. You can start by doing smaller functions and moving to more complex functions. Here is an example sequence of tasks:

  • Calculate the square of a number
  • Write a fibonacci number function using both a loop and recursion
  • Create a counter contract that counts how many times the increment() function has been called
  • Create a simple bank contract where each user can deposit and withdraw ETH
  • Add the ability to transfer holdings to another user. Fun fact – you have built your first “token” contract and this is a useful contract known as “Wrapped Ether”. An outdated reference implementation is here: https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code

While slightly outdated, you can use our syntax reference to quickly pick up relevant syntax (https://reference.auditless.com/cheatsheet/).

Learn to use Etherscan and ethtxinfo (< 1 day)

Remember the first task of using Ethereum? Go to Etherscan (https://etherscan.io/) and learn how to look at contracts, study their source code and understand transactions. Similarly, explore some transactions in https://ethtx.info/. This will be useful for on-chain debugging. Finally learn to use Metamask + Etherscan in conjunction to directly interact with some real contracts. For example, can you buy some Wrapped Ether: https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#writeContract?

Deploy your contract to testnet (1-3 days)

Using Remix IDE, you should be able to deploy your contract to an Ethereum Testnet. Learn about Etherscan verification and verify the source code of your contract. Then, use Etherscan to interact with it then use all the tools you learned (Etherscan, Ethtx.info) to inspect transactions. Note: you can interact with contracts that you have not verified using My Ether Wallet or lower-level tooling on your own computer.

Get access to a smart contract node (<1 day)

Look at Alchemy or Infura and get a node account. This will be useful for local development later on.

Learn a smart contract framework and move everything you did in Remix (1-2 weeks)

If you are comfortable with Javascript, set up a GitHub repo in Hardhat. If you are much more comfortable with Python, set up Ape (https://github.com/ApeWorX/ape). If you are working in a team, it may make sense to make a holistic decision on the framework; in that case it’s worth taking a look at Foundry as well (https://github.com/gakonst/foundry).

Learn how to compile your contracts. Write some tests and run them. Figure out how to deploy your contract to testnet again and run Etherscan verification. Try to break your code and experiment with debugging both locally and on the network.

Develop a contract that uses another contract (1-2 weeks)

Ethereum’s key feature is composability. The next challenge is learning to read and incorporate other smart contracts into your design. If you don't have any ideas, you could create a “vault” contract, which basically allows users to deposit a token and then invests it in another protocol for lending, liquidity provision or another type of yield generating activity). In practice this will mean:

Hopefully by this stage you would understand how to deploy this contract while referencing another contract on mainnet – you can deploy your contract to mainnet if you would like to try it (but note that it will cost Ether).

That’s it

Congratulations - at this stage, you will have completed a full development workflow in about a month. Depending on what you are trying to do, it may make sense to learn how to build a simple dapp (front-end for your smart contract), dive deeper into security topics, learn the inner workings of the EVM or build more complex smart contracts.

Some areas to focus on as you continue your journey:

  • Follow insightful Solidity engineers (e.g., https://twitter.com/transmissions11, https://twitter.com/brockjelmore)
  • Read more contracts. You will learn a lot of best practices from reading good quality contracts. Some contracts to recommend are the Uniswap V3 implementation and Rari capital vault contracts
  • Invest in your tooling. It requires a decent amount of research, curation and personalization to make the most of infrastructure. Solidity development can get very slow especially when you run lots of fork tests
  • Join relevant Telegram groups & Discords. For example, if you plan to build on AAVE, you should join their Discord and the development channel
  • Share your knowledge. By sharing your learnings and code on Twitter/GitHub, you will attract feedback and other developers.

See Also: