Learning Solidity: A Starting Guide

dylie.eth
CryptoStars
Published in
12 min readJan 31, 2022

--

Hi, I’m Dylan, a 19-year-old college student who has been infatuated with all of cryptocurrency and web3 since I was 14 in 2017. For the past four months, I have completely immersed myself into the web3 world, learning and absorbing as much information as possible.

Having extensive experience competitively programming throughout all of high school, I decided to start learning Solidity to pursue smart contract development in October. Since then, I have by no means become an expert, but I have advanced enough to be proud of my skills, and feel that I could give some useful advice.

This guide serves as a tool for those who want to learn Solidity, but don’t know where to start or resources to use. Let’s learn together ❤.

A large amount of the information within this article is going to be directly taken from other sources, all of which will be linked within the article itself. I don’t see the need to reinvent the wheel, so I’ll be taking advantage of the work that others have graciously provided.

Having the Right Mindset

I’m starting the article off with this because I think that taking the first step towards starting to learn anything can be incredibly difficult. Despite that, don’t become complacent. Impostor syndrome is real and almost everyone goes through it, but oftentimes what separates the average person from a successful one is whether or not they let it stop them from progressing.

Just start. Don’t expect anyone to push you or force you to start learning. You need to take initiative — with every excuse you make, you get further from completing your goals. I know this because I’ve been in the exact same place. It wasn’t until I fully devoted myself to pursuing smart contract development that I realized how much time I had been wasting. Everyone’s situation is completely different, but nothing should stop you from getting started. Currently, there is an extreme scarcity of smart contract developers, and with that scarcity comes great opportunity.

Will you capitalize upon it?

Or will you let this chance fade away?

It’s up to you to put in the effort and start learning.

What is Solidity?

Solidity is what’s called a high-level, object-oriented programming (OOP) language developed for and primarily used by the Ethereum blockchain. OOPs allow developers to build programs using prebuilt snippets of code.

Solidity was designed to be particularly user-friendly to anyone with a basic familiarity with other, more mainstream coding languages including C++, Java, JavaScript and Python. This means that people with experience in the general programming concepts and aforementioned coding languages would take a shorter time to learn Solidity. This could take anywhere from one to six months.

- Leo Jakobson

Don’t Be Intimidated by Having to Learn Yet Another Language

Although I had extensive programming experience before starting to learn Solidity, I picked up Solidity quicker than any other language I have learned in the past. I’ve heard similar stories from other Solidity developers, and to my knowledge, it's generally a fairly easy language to learn for those with experience.

That being said, I would probably not recommend learning Solidity as your first language or without any background in programming. Solidity at a production level requires you to think about programming in a fairly different way than most other object-oriented languages due to the nature of how smart contracts interact with the blockchain.

Consequently, I would recommend learning Javascript or Python prior to learning Solidity for those new to programming. While this may take longer, it’ll help you in the long run by building a stronger foundation as a developer. And remember, we’re not here to rush things as that's one of the primary reasons behind failed launches, inefficient contracts, and an overall worse user experience on the Ethereum blockchain (due to higher gas costs).

Learn Javascript from Free Code Camp

Back to Solidity

Solidity is a programming language for writing Smart Contracts. Essentially, think of it as a way to control a bank account with code. With Solidity, we can write applications that simulate a crowd funding campaign, a lottery, a loan, or any other type of financial instrument.

- Stephen Grinder

Solidity is not only used on Ethereum, but usable in any EVM compatible chains — Avalanche’s Contract Chain, the Binance Smart Chain, Fantom, and many layer 2s like Polygon. With EVM compatibility, developers can easily fork the code of smart contracts on the Ethereum blockchain to any other EVM compatible chains. This makes developing in Solidity incredibly versatile.

Ethereum’s smart contracts are built on a blockchain, so they cannot be altered or deleted. That means that Ethereum is a very secure way to do what it was designed to do — transfer anything of value, using either the native Ether tokens or the compatible but white-labeled ERC-20 tokens to pay for those transactions.

- Leo Jakobson

Solidity is Unforgiving

Since smart contracts are immutable, Solidity smart contracts must be near-flawless when deploying. This leaves very little room for error but isn’t necessarily a complete disadvantage — in fact, one could argue it's the largest advantage of smart contracts. Knowing they are immutable, you can clearly see what kind of interactions might take place in a given contract. This can remove the need for trust in several types of interactions, as long as you can read Solidity or someone who does, verifies a contract’s legitimacy.

Before you start trying to learn Solidity, I would gauge whether or not it is useful for you to do so. In my opinion, attempting to learn Solidity in a rush before the launch of a project only leads to inefficient smart contracts, botched launches, and an unhappy community. If you only intend to learn Solidity to use it once, you’d be better off hiring a developer (like me 😉) to do everything for you. Before hiring a developer though, make sure they know what they’re doing. There is a plague of “developers” in this space who can only copy-paste code and slightly edit it, without actually understanding what they’re doing. This has been a major contributor to the problems I’ve previously mentioned.

But if you’re learning it to educate yourself, develop for projects in the future, or simply for fun, you’re in the right place.

Foundational Knowledge

In my opinion, before even starting to learn the language, you need to have a strong foundational knowledge of what smart contracts are, how blockchain technology works — and specifically how Ethereum operates.

Even if you feel that you have a strong understanding of the blockchain, I would still recommend refreshing your knowledge and reinforcing it. This will only help you in the future when developing smart contracts, as there are fundamental differences in the manner by which you write them compared to traditional object-oriented programming. Code is optimized in a very different way, due to the nature of how smart contracts interact with the blockchain.

While I haven’t personally read through all the resources linked within the article below, I would heavily recommend checking at least a couple of them out to strengthen your knowledge — especially if you are newer to the crypto/web3 space.

The Ethereum Guide: https://www.wslyvh.com/ethereum-guide/

Ethereum Gas

Understanding what gas actually is and how it works at a high level is incredibly important in being a competent Solidity developer. Even if you think you have a good enough understanding, you might not — so I would heavily suggest fully reading the following article.

Getting Started

There are many places you could start, but in my opinion, the first hour and a half of this video is one of the best. It goes over a lot of key topics, walks you through understanding the basics from start to finish, and was made by Patrick Collins, our favorite Chainlink developer ❤.

I don’t personally think the python sections are as important (for the path I’ve taken in smart contract development) since I primarily use hardhat for local testing — but it’s a great resource nonetheless.

I have personally watched this video in full, just to be able to vouch for it — and I definitely can.

I would strongly recommend watching the following sections:

Foundational Knowledge: 00:00:00 to 01:30:00

Practice with Solidity: 01:30:00 to 03:26:00

The Beginnings of DeFi: 08:23:00 to 08:36:00

Starting with NFTs: 09:50:00 to 11:49:00

Where should I start actually learning the language?

The classic and traditional response to this question would be the official documentation for Solidity. While I do feel like that is a completely valid choice, and will link it here: https://docs.soliditylang.org/en/v0.8.11/. As someone with programming experience, I saw more progress watching video series and reading articles that condensed the behavioral nuances of the language into short videos.

I love the Smart Contract Programmer and his videos. His playlists on Solidity served as my gateway to understanding how Solidity worked, its differences from other languages, and how to read it at a functional level. While watching all of his videos won’t make you a Solidity developer, nor improve your ability to actually use the language, it’s a decent starting resource to learn from prior to getting started on your own projects.

Ferdi Kurt’s Solidity Fundamentals Article Series

Ferdi Kurt does a great job of summarizing a lot of the base-level Solidity nuances in an organized, short, efficient manner. He has posted a number of articles that each go over different topics such as value types, data location and assignment behaviors, and functions within Solidity. Reading through all of his articles and putting in the effort to actually internalize what you’re learning will heavily strengthen your basic knowledge of Solidity. I’ll link the first article within his multi-part series below.

Practice Makes Perfect (Sometimes)

As with any programming language, you will only get better at Solidity by actually using it and working on projects that require you to understand it better. The reason why I decided to place this section after the previous sections is that with all the inefficient smart contracts polluting the Ethereum blockchain, a strong foundation is necessary to really become a decent Solidity developer. It really isn’t worth it to take shortcuts and not doing so will help you tremendously later down the line.

Start Reading Existing Contracts

I cannot stress this enough. Reading existing contracts and actually attempting to understand them will heavily increase your proficiency and understanding of the language. I initially dove into Solidity to be able to identify scams and rug pulls within meme coin contracts and then moved on to analyzing NFT smart contracts.

You need to become a sponge — I became proficient fairly quickly by completely immersing myself in the space, absorbing as much information whenever I could.

Since everything on the blockchain is essentially open-source, you can advance at an incredible rate by analyzing all the contracts that you interact with — yes, all contracts, including the bad ones. When you see you just paid an incredibly low gas fee to mint an NFT, look into why that was the case. Or in the opposite case, where you paid an incredibly large gas fee, try to actually understand what inefficiencies led to such circumstances.

Be aware that the amount you spend on gas is not only dependent on a contract’s efficiency but also the gas price at which your transaction succeeded. I’ve seen many people refer to their transaction fee when referring to how efficient a contract is, but that is not necessarily a valid indicator by itself . When determining how efficient a contract’s transaction might be, you should be looking at the amount of gas used. This removes the discrepancy caused by differences in the network gas price and allows you to objectively analyze a contract’s efficiency.

OpenZeppelin: A library for secure smart contract development.

Almost all base contracts deployed on Ethereum are either from OpenZeppelin themself or derived from the contracts found there. They’re completely open-source and well documented, so I would recommend reading some of their documentation somewhere along your journey. Preferably at the beginning, as that’s when you’ll benefit the most, but I know that you’ll probably want to cut corners and get to working as soon as possible.

buildspace: A completely free web3 education startup

buildspace is an incredibly well-designed platform that guides you on starting your journey in web3 development, whether it be Solidity or another language like Rust. They provide several detailed projects for newer developers to build, walking you through the whole process. There’s an incredible discord community that’s always there to help and answer questions, so it’s a great environment to learn.

If you want to start working on some projects, but have no idea what to create, where to start, or even how to get started, buildspace is a perfect resource.

CryptoZombies

In addition to buildspace, I have seen a lot of support for CryptoZombies, which guides you through learning Solidity using interactive coding lessons. The lessons teach you how to create your own blockchain-based game (centered around zombies). I personally haven’t used it myself, but figured I would link it here anyway.

Udemy’s Ethereum Blockchain Developer Bootcamp With Solidity

Although I haven’t personally taken this course, it’s the highest-rated Solidity learning course and has an incredible amount of positive reviews and feedback. From what I’ve heard, it should be an incredible, fully fleshed-out resource that fully explores what you’ll need to really get started with Solidity.

The Ethereum Blockchain Developer Guide

You’ll probably learn all of the stuff contained within this guide throughout all of the other resources I’ve provided, but it functions well as a standalone resource. It will walk you through the basics of how to actually get started, start programming and create some basic contracts — explaining it the whole way through. It isn’t that long of a guide in comparison to some of the others, so I would recommend reading it first if you’ve got some free time as it will make it way easier to learn from the other resources.

“How to Learn Solidity in 30 Days”

This article, written by Tom Terado, essentially serves the same purpose as the article you are currently reading. It’s a compilation of some basic information regarding Solidity, along with a path and resources you could take to start learning it. I liked a lot of the resources he included within his article but didn’t feel like it was necessary to throw them all into mine. It’s pretty well made and well compiled, so it’s a decent read if you want some more resources or don’t vibe with some of the ones I provided here.

A Step Further: NFT Contract Optimizations

Optimizing your contracts is essential for improving the user experience of those who interact with them. Nobody wants to pay high gas fees, and having an optimized contract can drastically improve your community’s thoughts regarding your project. I’ve read a plethora of articles, contracts, and resources regarding how to optimize NFT contracts specifically — and found the following articles to be the most informative, and helpful overall.

Once you have a decent understanding of Solidity and are working towards building your own projects, you really should read the following articles. Understanding the techniques by which certain optimizations are made will drastically help you in the future, and also directly help you in making your code more efficient.

These aren’t in any particular order, except for the first article by Chance, which is by far the most phenomenal article I have come across throughout my journey. I swear … it’s worth reading. Additionally, I personally think Azuki’s taken strides with its compilation of improvements to ERC721 with ERC721A, so I would suggest reading their article about it.

This article is a work in progress, so feel free to leave any suggestions within the comments.

If this helped, I’d appreciate it if you clapped or at least followed me on some of my social media 🥳.

Twitter: @dylie_eth

Tiktok: @dylie.eth

Beacons: https://beacons.ai/dylie

--

--