Learning Solidity and Web 3.0

Defi dapp code example

tl;dr Initial experiences learning about Web3 and Solidity


Publish Date: 2022-05-17


Return Home

The past few months I finally took the dive and started learning about Web 3.0, cryptocurrencies, blockchain, and the Solidity programming language. I'm still very much new to this area, but I thought I'd share some initial thoughts on all of them just in case there are folk out there who are considering whether they should be learning about Web 3.0 with crypto becoming an increasingly common thing in 'life' and the continued talk about the Metaverse.

First, as always, some disclaimers and background. I am, or maybe more accurately, was not a crypto early adopter. While I didn't buy into Bitcoin or any other cryptocurrency (unfortunately) I wasn't a complete skeptic about them either. Like, I didn't think it was all BS and a scam, it was more I considered it a speculative investment and didn't really have the funds to put into something like that 🤷🏻‍♂️. Blockchain was something that seemed interesting, but I didn't really understand it so I didn't bother to really learn much about it.

If you're a first timer to this blog, then welcome, but also my programming background is a bit on the short side as I come from an education background. I started learning coding and web development a little over a year ago, and have mainly focused on front-end stuff like HTML, different flavors of CSS, Javascript, React, Next JS, and Svelte. I've also played around a bit with Python and Swift.

Learning Solidity

I still have a long way to go to really understanding Solidity, but some thoughts. Solidity - in its own documentation - describes itself as being "inspired by C++, Python, and Javascript". I haven't learned C++, but have experience with Python and Javascript. I can't compare them on a technical level, but can say that Solidity feels similar to me to Javascript - or more accurately because it is a statically typed language - to Typescript. Functions are written in a similar syntax and the overall flow of files also feels similar. So it didn't feel like a completely new experience. If you're already a semi-experienced web dev or programmer you will probably not feel completely lost in Solidity.

One weakness that I had, not coming from a computer science background, was learning and differentiating some of the different types - particularly the different int and uint types - why use some versus others and what they are exactly. How to know when to use say, uint8 or uint or uint256. Things like that.

Another thing that I still don't really get exactly is how to know which version of Solidity to use. Solidity (as of writing) is on version 0.8.14, but if you follow along on many online tutorials you'll see projects being written with Solidity 0.5.* or 0.6.* or 0.8.0. These tutorials may be only a few months to within the past year old, so it was a little surprising to see. Also some of the longer tutorials would switch versions, and not really explain why they changed Solidity versions. It seems one needs to be familiar with multiple versions of Solidity. Solidity recommends using the most up-to-date version of course, so that adds to my confusion. Is there any reason to not use the most recent version of Solidity barring the contract(s) being worked on were previously written using an older version? (if you know, drop me an email please)

While not unique to Solidity, I do like how you can import contracts into other contracts to extend their capabilities like classes. It makes it very easy to incorporate existing standard contracts and slightly tweak and modify them to meet your project's needs.

One thing that I don't like, or more accurately am concerned about as a relative newbie to Solidity and smart contracts, is their 'immutable' nature. Making sure the contracts are written and function like they need to, and making sure there are no easy to exploit (or any ideally) security flaws in the logic. When writing regular web apps, if there is a bug it is possible to go back in and fix the problem and just redeploy with no problem, but with smart contracts you can't do that. You would have to deploy (and pay for) a new smart contract and re-direct all the traffic to that new contract.

On a final note let's talk about how Solidity combines with other programming languages to actually be usable in the real-world. It seems like for most, Solidity combines with either Python or Javascript to be usable on the internet - and if using Javascript usually React is also used. Fortunately, using one of the various libraries that connects Solidity code with Javascript code is fairly easy. Hardhat and Truffle are pretty good. Ethers.js is okay.

Recommendations for Learning Solidity

CryptoZombies - I would recommend starting here. CryptoZombies is a game created by Clever Flare and you can do a relatively lengthy tutorial coding out aspects of the game such as creating zombies, their actions, and transferring zombies between users. As you code the tutorial explains what everything is doing and you can check step-by-step what is correct and not (although the checker is a bit picky at times).

Dapp University - Recently they launched a Bootcamp (online), and I haven't checked it out. But, they do also have a fairly large YouTube channel that has tutorials and broad information about the crypto market and Web 3.0 in general. Most of the videos are a little older, but are still highly informational if you're a beginner.

Patrick Collins - He has his own YouTube channel as well as stuff on FreeCodeCamp's YouTube channel. He also has a number of long videos going step-by-step through developing smart contracts and building them out into Web 3.0 apps. If you're a Python user I recommend his videos because he strongly prefers Python over Javascript for web app development.

Nader Dabit - Nader Dabit's YouTube channel was my first experience with Solidity and Web 3.0. Like the other two YouTube channels listed you can find Web 3.0 tutorials, but they tend be a little shorter than the others. I would say this channel would be better for when you have some knowledge of the basics of Solidity.

Thoughts on Web 3.0

But anyway, this is not a tutorial on Solidity (maybe once I learn a bit more). I do feel the need to talk a little about how I feel about Web 3.0 since that is what Solidity is for. Is the era of Web 3.0 nigh? Should all web devs be scrambling to learn how to change their sites over to Web 3.0 versions?

To be honest, I'm a little skeptical about whether what we currently refer to as Web 3.0 will truly happen. Because while there are some nice things about blockchain and crypto I think it has a long way to go until there is massive usage of it. Despite what advocates will say, crypto (and as such Web 3.0) has a significant image problem - the recent crypto crash is not helping things much either in this regard. For many it's still a high risk, purely speculative, get-rich-quick type of thing. As long as this image remains, it seems difficult to expect that large companies, governments, and individuals will heavily invest in the sector.

And as long as mass adoption does not happen, Web 3.0 will continue to struggle with issues like transaction speed and costs. In some ways it feels a little like a chicken or the egg conundrum - which will happen first? Large corporations will take on significant risk to help facilitate mass adoption or will mass adoption have to happen through individuals/small businesses and then large corporations will join in to really facilitate Web 3.0 worldwide?

My other big question about Web 3.0 is which cryptocurrency will be used as the basis for it. Currently that's Ethereum, but I do wonder if that will actually be the case. Ethereum's issues are fairly well known and whether it is able to transition into its next phase ("the merge") is something I'm slightly skeptical about simply because it seems like they've been talking about it for several years now, but it has not really happened. As such will you see another cryptocurrency like Cardano or Solana take the lead? Ultimately it probably doesn't matter, but in the early goings it could be very important.

My final thought on Web 3.0 is what Moxie Marlinspike wrote back in January about Web 3.0. To summarize, is Web 3.0 really capable of doing what its proponents say it can or will it just be a case of a new group of large companies replacing the current group of large companies? His case is highly compelling. Currently, you can directly access the blockchain, but it is difficult and the vast majority of 'regular' folk will not be willing to learn how to access it directly. That means that somewhere there will need to be people or companies that help connect you to the blockchain. Right now that is largely companies like Infura, Alchemy, OpenSea or MetaMask. Sure your data lives safe and secure on the blockchain, but if that middleman blocks your access to the blockchain is that really any different than Meta or Google blocking or filtering results shown on their server? Maybe one day it will be possible and easy for everyone to access the blockchain without needing a middleman, but until that day comes Web 3.0 seems like it will remain far from its goals.

Wrap Up

So, is Web 3.0, Solidity worth learning about? Well, yes it is worth learning about. I don't know if one should invest a significant amount of time learning the in's-and-out's of Solidity unless they have a specific goal in mind or unless they have some free time to burn and are curious. But, overall I think it's worth knowing the basics of if possible. I certainly don't regret learning more about a space and language I didn't know much about, but am not sure if I'll be spending a huge amount of time in the area in the near future.

It is easy to get wrapped up in the excitement and ideas around Web 3.0, but it is important to also remember that there are significant issues facing its future. Additionally because there is so much money in the space these days (although significantly less now) there will be plenty who are not interested in advancing Web 3.0's ideas and are just looking to make some money in the short-term.