How to Learn Solidity Programming (the Fun Way)

By Nat Eliason in Programming

Published or Updated on Aug 05, 2021

I feel a little silly writing this: I'm still figuring this out myself. But it turns out there are very few good solidity developers out there, and even fewer who also have a popular blog, and I keep getting asked this, so here we are.

At this point I've learned enough to write easier smart contracts and deploy interactive applications on Ethereum. Like one for creating a shared allowance with others (could be for kids, company teams, etc). And another for a "central bank" UI for managing your own token.

And recently I built the two tokens as well as the two incentivized staking programs for Crypto Raiders (four contracts total). That was my biggest project so far, and a lot of fun! Now I’m helping them build an in-game marketplace.

So I'm not an expert, but if you're reading this, I'm probably at least 3-6 months ahead, which in the Solidity world is pretty meaningful. 6 months of Javascript experience is nothing. 6 months of Solidity is probably a six-figure job.

Okay back to programming. I personally prefer to learn by doing, so this guide is heavy on interactive courses and projects where you get your hands dirty. I believe pretty strongly that you should learn how to do some stuff first, then circle back to understand the why later. Making MetaMask pop up on your site for the first time is exciting. Reading documentation isn't. So let's have fun with it!

I'm going to assume you already know a few things:

  • You know what Ethereum is and how to interact with a Web3 site using MetaMask. If not, I recommend doing that first or going through my DeFi Orientation course.
  • You're comfortable in HTML, CSS, Javascript, and React. You can build Ethereum apps in Python too but this guide is focused on JavaScript. If you need to start by learning these, I'll add an appendix with some resources.

This is going to be an ever-updating, ever-evolving guide as I keep learning. So bookmark it and check it again in the future if you run out of stuff to work on.

This is titled "how to learn Solidity" but Solidity on it's own isn't super useful. What you really want is to learn the whole "Web3" or "Decentralized Apps" programming stack.

That Web3 stack can be broken down to learning three areas:

  • Creating interactive Web Apps
  • Interacting with the Ethereum Blockchain
  • Writing Smart Contracts

All three of these are incredibly valuable skills, and learning even one of them makes you a highly sought-after developer. Learn all three to a high level and you can basically charge whatever you want and build whatever you want. Yearn for example managers billions of funds and the V1 was built by one guy. Your personal leverage as a Solidity developer is insane.  

Each topic area has a few languages or libraries you'll need or want to learn:

  • Creating Web Apps: JavaScript, React, NextJS (optional)
  • Interacting with Ethereum: Web3JS, EthersJS (both are worth learning)
  • Writing Smart Contracts: Solidity

I recommend starting out with some holistic resources that touch on all three, then dive into the "going deeper" material depending on which you feel like you need to get stronger in.

The goal is to just get to the point where you build something on your own and deploy it to a live network. That'll get you excited to see what else you can build.

My Adapted Learning Track

Step 1: React Foundations

I had some basic Javascript but I didn't know anything about React, so I had to start here. You don't have to learn React, but almost every Web3 app is built with it, so it's worth it.

This course was fantastic, but you only need through lesson 15. You don't need to learn Redux.

After that, you can do a React project on your own (I did) or just move on to Step 2.

Step 2: Your First Ethereum Apps

Next I recommend taking this intro to Ethereum and Solidity course.

Now one important caveat: this course is kinda old! The tooling has gotten better since it was made, so don't get too hung up on his style of doing things. If you don't like it or get bored, you can skip to the next section and you'll be fine.  

What's great about it though is you'll get more practice with React, you'll learn some Web3JS, you'll write a few smart contracts and understand how they work, and you'll put it all together into an actual app you can play with on a testnet.

ONE SUPER IMPORTANT NOTE During the course, you will deploy some apps using a kinda outdated method involving hardcoding your private key. PLEASE USE AN EMPTY WALLET FOR THIS! I was an idiot and used a wallet with actual money, then published my secret key on github, and some hacker stole $30,000 from me. Ouch. (tk)

Anyway, did you get through the course and not get hacked? Great! Next up...

Step 3: A Bit More Smart Contract Practice

Assuming your React is decent, the Web3JS stuff is pretty easy. You need more practice writing contracts.

I recommend working through this course, but only the "Learning Solidity Step-by-Step With Labs and Slides" section.

He has you write a bunch of different little smart contracts that are really helpful for understanding the core solidity functions. It's a good way to get reps in.

After that, go through CryptoZombies, the first 6 lessons. Again, this is more practice getting in reps with writing smart contracts so you get the hang of it.

At this point you'll have written quite a few smart contracts, and its time to start getting comfortable putting stuff in the wild.

Step 4: Your First (Mostly) Solo Deployment

Time to put it all together. Open up this article by Nader Dabit and follow along to build a very simple Ethereum app from scratch.

The article will bring together everything you've learned so far to take a super-simple smart contract, put a UI around it, and deploy it to a local testnet where you can interact with it.

This will also introduce you to a couple incredibly useful tools: EthersJS, a newer Javascript library for interacting with smart contracts (and the one I prefer, personally). And Hardhat, a tool for running and testing a local Ethereum node.

This was where I had the "whoa" moment. Once you get through this exercise and it feels like things make sense, you have everything you need to start building on your own.

Step 5: Your First Real Solo Deployment

Now that you've gone through the motions of putting together some simple contracts, wrapping them in a UI, and deploying them, it's time to try making your own from scratch.

The biggest bottleneck at this point will be your own creativity. You need to start thinking up ideas for contracts that are challenging and stretch your abilities, but not so challenging you give up.

If you want a couple ideas, try launching an ERC20 token and building a "central bank" to manage it.

Or for something more complicated, try writing an "allowance" contract where one person can create an allowance wallet and give permission to withdraw certain amounts from it to another wallet.

You can see my central bank implementation here, and my allowance implementation here.

Step 6: Going Deeper

This is where I'm at now, trying to figure out how to go deeper from here.

But I think from here you just keep trying to learn more Solidity. The Web3JS and UI stuff is honestly quite easy, it just takes some reps. It's learning to think in smart contracts that's hard. So you have to write a lot of them. I'll keep adding ideas as I have or find them!

From talking to some experts, the answer seems to be just building lots of stuff. So start building! If you’re worried about pushing stuff to production just yet, see if there are any DAOs or companies you can help out. Join a few Discords and look for opportunities to contribute. 

List of Practice Smart Contract Ideas

I recommend figuring out which part of crypto interests you, and then trying to rebuild different tools and apps in that space. Here are some random ones. Shoot me a DM on Twitter if you have other ideas I should add and I'll credit you.

Remember that the smart contracts for every major project are publicly readable on Etherscan. If you're ever unsure how to do something, just go read some existing contracts!

DeFi Projects

Build an incentivized staking contract. One where users can deposit a token and earn rewards in the form of another token based on some daily rewards rate.

Build an inflationary staking contract. Same as the normal contract, except instead of receiving pre-loaded rewards, the contract mints more of an ERC20 token every day as the rewards.

Build a time-locked staking contract. Same as the last two, but give users the option to lock their funds in the contract for a higher reward rate.

Build a simple borrow & lend protocol. Let users deposit one kind of asset and earn interest on it. Then let them also borrow against that asset and have to pay back interest to unlock their funds.

Build an autocompounder. I’ve started a bit on this and it’s actually not too bad! 

Try launching an ERC20 token. This is actually super easy once you look at the OpenZeppelin docs, you’ll be surprised by how straightforward it is. 

NFT Projects

Try launching your own ERC721 (NFT) token! It’s not too hard if you use the OpenZeppelin standard, and it’s a fun way to practice.

Build an NFT Marketplace. Nader has a great guide on this as well.

Going Deeper Resources

Getting Better at React

I've heard consistently great things about Epic React. Though I have not taken it yet. I went through the React course above and that was enough for me to get started.

Learning NextJS

NextJS is a common production-focused framework on top of React that's used by a lot of the crypto community. I've really enjoyed it and recommend learning it as well, though it's not strictly speaking necessary.

This course was very helpful. But instead of doing the final project, I recommend just trying to apply the lessons to one of your existing projects. From there you can figure the rest out from the docs.

More Solidity Practice

Writing as many contracts as you can think of is going to be the most helpful here. But there are some other resources you can check out too.

Mastering Ethereum by Andreas M Antonopoulos is the book on the subject. Unfortunately, it's light on the Solidity examples and focuses more on the underlying technology and security, but it's still worth skimming through.

Austin Griffith's Scaffold-ETH also has a ton of good projects in it you can check out to get ideas from.

Other Solidity / Ethereum Development Tools to Try

HardHat is the local Ethereum development environment you'll use in the guide above, but you might also learn how to use Truffle in case you work with a company that uses it. 

Scaffold-ETH is a fantastic tool for quickly turning a contract into a UI. 

What if You Need to Learn HTML / CSS / JavaScript?

For HTML and CSS I’d probably recommend going through the Codeacademy course on it. If I remember right it’s pretty good and will give you a good foundation. 

From there, I’d check out Wes Bos’s courses for JavaScript and building Web2 apps. Specifically I’d work through Beginner Javascript, then go ahead through Mastering Node as well so you get some Database experience. I do not recommend the React course until he updates it, since it uses some out of date methods. 

Once you get through those, try whipping up a site or two and going through the whole process of thinking up the idea, building it out, pushing update to Github, and publishing it live. 

Footnotes

You Might Also Like...

No items found.

Enjoyed this? Be sure to subscribe!

Comments

Comments are reserved for site members only. Not a member? Sign up here.