My journey into web 3
Saying that it’s unlikely you’ve not heard or read about web 3 lately would be an understatement. In just a few months, the decentralised world went from being there to being everywhere. From NFT profile pictures to shiny new blockchains, it’s been all over the Twitter sphere and has been both celebrated as a revolution for freedom and criticised as a frenzy that will destroy our planet.
In this article, I’ll start by giving web 3 a brief high-level introduction before mentioning how and why I ended up getting more and more interested in this decentralised world and more particularly NFTs and the Solana blockchain.
As a little disclaimer, I would like to add that I didn’t know much about web 3 until around a month ago so I still have a lot to learn and some of my views might appear too simplistic for more advanced readers. Please be kind and feel free to comment on things that could be improved in the comments and I will make sure to update the article accordingly.
What’s web 3?
Web 1 gave us the basis of the internet. Static pages, FileZilla, positioning with tables, etc. If you’ve ever had to design email templates, you’ve basically gone back in time to web 1.
Web 2 improved on top of that basis by allowing us to gather and display user-generated content. This allowed web applications of all sorts to flourish and gave us the internet we know today.
Web 3 isn’t a direct improvement of web 2 but rather an alternative approach to computing and storing information. Web 2 uses a bunch of servers owned and controlled by the company that created the application whereas web 3 uses a network of servers that can be owned by anyone to compute and store data.
It works by receiving events that alter the data — called transactions. They are first authenticated and verified by a network of servers — called a cluster. When the cluster reaches a consensus, they are then stored in blocks of multiple transactions that are duplicated and propagated to the entire cluster creating a public and decentralised digital ledger that we call a blockchain.
Anyone, including you, can set up a server and become a node in a blockchain’s cluster. If you do though, it will cost you a significant amount of power to run and you can expect your electricity bill to be much higher on your next meter reading. That’s why blockchains usually reward servers in their clusters by offering a small remuneration paid in their own cryptocurrency — a.k.a. mining.
The cryptocurrency of the blockchain creates an economical balance where users of the blockchain end up contributing to the cluster’s remuneration. So instead of paying monthly for your server in web 2, you pay a small fee for each transaction that you send.
I won’t talk about blockchains in much more detail because A. I’m not the most qualified person for that task and B. the actual architecture of a blockchain can vary significantly from one blockchain to another as we will see with Solana in this article.
Why is it so popular now?
The decentralised web is not new. Bitcoin was released in 2009 and Ethereum in 2015. Until recently, web 3 was mostly used in finance as a way to decentralise financial entities such as banks and brokerages to disturb their monopole and bring more transparency to the industry. It created a whole new era of applications called DeFi for “Decentralised Finance”.
In my opinion — biased by the fact that I never paid attention to web 3 until now — what skyrocketed the amount of attention projected onto the decentralised web are NFTs. All of the sudden, you had stories everywhere about people and even celebrities buying pixelated pictures that could be done on Paint for millions of dollars. That sure created some interest in investing time in this technology — that was once considered niche — since it had the potential of yielding a tremendous return of investment.
NFTs and use cases
If you’re confused about what NFTs are, they stand for “Non-Fungible Token” and represent an entity that can’t be replaced with something else and thus can only be priced based on what others are willing to pay for it. Reversely, we say a litre of olive oil, a kilogram of gold or $200 are fungible because they are replaceable by another identical version of themselves and therefore their value is known and set by the market. Just like in the physical world, NFTs have strived in art. Instead of buying a painting, you’re buying a record on a blockchain that says you own a digital asset.
Whilst NFTs are vastly popular in web 3, they are certainly not the only blockchain use case out there. Fully decentralised communities with no leadership are also flourishing and are known as “Decentralised Autonomous Organisations” (DAO). These communities typically use a decentralised application — known as a dApp — to reach a consensus among their members. Just like web applications in web 2, dApps can be created for any number of use cases such as crypto gaming and DeFi.
What lead me to web 3
Like everyone, I could see web 3 slightly taking over my Twitter timeline but didn’t pay much attention to it. I was slightly interested to know how it all worked but didn’t really know where to start. Then I came across a live feed from Nader Dabit deploying an NFT smart contract similar to the Loot project but instead of clothing items, it was developer items and characteristics that were randomly picked. The vision for that NFT was (and still is) to create a developer-focused DAO — called Developer DAO — where you need to own one of these NFTs to be part of the community. Since minting the NFT — i.e. claiming an NFT that’s not been generated yet — was free I decided it would be a good way for me to dip my toe into this world.
I downloaded the MetaMask chrome extension, created my first Ethereum (ETH) wallet and then followed this tutorial to mint my first NFT. Note that minting an NFT is usually easier than this because the creators can implement a frontend client that interacts with the blockchain and abstract all the necessary steps for you.
Whilst minting the NFT was free, I still had to fund my ETH wallet to pay for the transaction free — a.k.a. gas fee. That’s when I found out that a single ETH transaction can cost between $40 and $400 depending on how cluttered the network is.
Imagine creating a web application that charges your users between $40 and $400 every single time they interact with it. Want to update your password? $45, please. Want to change your project’s title? $168, please. Insane.
Fortunately for me, the gas price that evening was around $60 so I went for it. And just like that, I owed my very first NFT.
NFT research
Whilst I’m not planning on selling this one, I did start to get interested in NFTs in general and how to predict the ones that will be successful. Minting an NFT is usually pretty low cost — depending on the hype of the project — so if you bet on the right one, you can make an insane return. For instance, Mekas were minted for 0.2 ETH (~ $770) and sold the same day for 7 ETH (~ $27’000).
Note that the ETH conversion rate was taken at the time of writing this article.
That being said, it’s not always easy to bet on the right NFT and even with all the research in the world, the volatility is ridiculously high. You can easily end up in a situation where you mint 2-3 NFTs for $200 each and a week later nobody cares about these projects anymore and you’ve just lost $600. Even with projects that are going to be clear winners like the Mekaverse, they often implement a lottery — a.k.a. a raffle — that randomly decides who will be able to mint one of the 8888 Mekas available. Since hundreds of thousands participated in the raffle, you had to be pretty lucky to get one in the first place — sadly but predictably, I didn’t.
The other side of NFTs
Then I got interested in who made these NFTs, how, and how much money they were making. After all, investing and trading digital art is not really my thing but, as a developer and creative person, I could potentially create my own.
So I did some number crunching and yep that’s a lot of money. Let’s take Mekas as a successful example here to see how much they made on their launch day. They sold 8888 Mekas for 0.2 ETH each — technically they sold a bit less because they reserved some for marketing purposes but let’s just keep it simple. That’s 1777.6 ETH or around 6.8 million dollars at the time of this writing. On top of that, they have a 2.5% royalty fee on secondary sales. That means every time someone that owns a Meka sells it to someone else, the creators of the Mekaverse take 2.5% of that price. Currently, Mekas have a total trade of 36800 ETH on OpenSea (a popular NFT marketplace for Ethereum). Take 2.5% of that and that’s another 920 ETH or 3.5 million dollars on top of their initial 6.8 million. And that number will continue to grow as Mekas continue to be traded.
Now, not all NFT projects make that sort of money and a lot of them are giving a significant percentage of their earnings to various charities but all in all, it’s not impossible to make a few million dollars by creating your own NFT projects.
Because of this, you see hundreds of new NFT projects being launched every week and, sure, there is this consideration that it could be a bubble that’s not going to last forever. However, I do feel that if you design your project in a way that brings something new, something different and something that’s going to create a community, you have the potential to succeed and you don’t even have to rush.
But if you’re going to go down this road, a candy machine NFT drop — you insert lots of randomly generated images in an existing program and allow others to mint them one by one — won’t be enough. You’ve got to create your own smart contracts and dig deeper into the world of blockchains. And that’s what I did.
Choosing a blockchain
Choosing a blockchain is not easy because there’s plenty to choose from. A lot of people decide to go with Ethereum because it is the most popular blockchain especially in the world of NFT. However, I still couldn’t get my head around the insanely high transaction fee and the amount of time and power it takes for the blockchain to validate a transaction.
Additionally, this has caused web 3 to be vastly criticised due to its ecological impact. For instance, I’ve only made 3 transactions with my ETH wallet so far and, according to carbon.fyi, they have caused 43kg of CO2 emissions. That’s the equivalent of the CO2 emissions of an average person for 4 days! With the scale at which the Ethereum network is being used, you can see why people are complaining, especially when they find out it’s all for exchanging pictures of pixelated monkeys.
Sadly, all blockchains get thrown in the same bag but it is not the case. Old blockchains such as Bitcoin and Ethereum do not scale well because of legacy reasons but most of the recent blockchains do acknowledge that a more sustainable web 3 is crucial for the future of the decentralised internet.
A lot of those recent more scalable blockchains build on top of what Ethereum has done and even use the same language for creating smart contracts called “Solidity” making it easier to deploy in many blockchains and reducing the learning curve of learning new ones. They typically improve on Ethereum by changing a few algorithms and making them more scalable.
However, there’s one blockchain out there that decided not to play by those rules and to start everything from scratch and that’s Solana. Its blockchain implementation is so different to the others that it feels like it’s just living on its own desert island. Its mission is to solve the scalability issue with its high-performance protocol in order to make web 3 more scalable, affordable and sustainable. It has a total of 8 core innovations making it the best blockchain network by transaction speed as of July 2021.
And the transaction fees? It’s currently at $0.00025 and is set to never go above $0.01 no matter the scale. That’s more like it. I don’t mind updating my password for that price.
So I was hooked and decided to embark on that desert island and forget about all other blockchains. I have a few friends that have chosen other blockchains and we can never understand each other because the architectures are massively different.
Learning about Solana
Getting started with a fairly new blockchain that looks like no other was not an easy task. Depending on when you’re reading this article things might be different but there is definitely a lack of documentation, articles and tutorials simply because of how new the ecosystem is. That being said, I have been extremely surprised by the speed at which the Solana ecosystem is growing. Almost every week comes with major improvements, new projects, frameworks, tutorials and/or courses.
I started by reading the "Programming on Solana - An Introduction" article from Paul Schaaf which has been widely successful in the Solana ecosystem as one of the only detailed tutorials on how to create programs in Solana — smart contracts are called programs in Solana. The article creates an "Escrow" program from scratch and whilst it says it’s a one hour read, it takes a good day to digest.
It introduces key concepts that are unique to the Solana blockchain such as programs, accounts, PDAs, etc. Even though it took me a whole day to read and digest, I have to say some of these concepts didn’t resonate with me until I started putting them in practice days later. So if you’re interested in reading this article, you kind of need to accept that some things won’t make much sense until later.
Furthermore, the program written in this article uses no framework or any abstraction to make the code easier to understand. Whilst this was frustrating to read because you constantly see the potential in extracting generic logic (such as transforming data from and to arrays of bytes), I actually think there’s value in learning how to create programs that way to really understand how they work.
That being said, I searched for a Solana framework and found Anchor. It takes a lot of the low-level pain away from you such as serialisation, defining instructions, verifying accounts, etc. It certainly isn’t what Laravel is to PHP but it is a good step in the right direction and the framework keeps becoming better and better.
Shortly after finding out about Anchor and playing with their getting started tutorials, Nader Dabit released an article called "The Complete Guide to Full-Stack Solana Development with React, Anchor, Rust, and Phantom". The timing couldn’t have been more perfect. I was able to follow the steps and create a full web application that was using a program on Solana as the backend. Even though the application was a simple counter, that was a key moment for me because I was finally able to create full web 3 applications — dApps — in Solana and apply everything I had learned before.
Learning tips for under-documented ecosystems
Getting started in the Solana ecosystem was a unique experience for me because I had never dived so early in a technical field. If I had a specific question, I simply couldn’t rely on documentation, Stack Overflow or third-party articles like I’m used to. So I developed a few techniques that I’ll mention here.
The search feature of GitHub has been a tremendous help. By simply searching for relevant pieces of code and setting the language filter to "Rust", I was able to find public repositories of other Solana developers that had gone through the same troubles as me and learn from their code. None of these repositories had any stars or was listed anywhere because they were just little labs for developers like me trying to make sense of it all. I found a lot of gems and answered a lot of my questions using this simple technique and I will definitely continue using it in the future.
Using an IDE was crucial for me as I was using Rust for the first time. At first, I kept everything in VS Code with a few helper extensions but Rust is a very unique language and I kept having to google things to understand its quirks every 5 seconds. Then I decided to use CLion from JetBrains and suddenly everything became a lot smoother. The IDE was autocompleting things for me and I was able to quickly understand why types, references and lifetimes weren’t working. I won’t make this mistake again and I’ll make sure to have an IDE to hold my hand when learning new complex programming languages.
Searching and posting on Discord was another useful technique for me. Discord seems to be a very important tool for web 3 communities and you are going to end up signing up to a few Discord servers to get by. Most of these servers have one or more "Developer support" channels where devs can ask any question and hope someone helps them. I have to say more often than not you won’t get an answer because the probability that someone who knows the answer is online at the exact time you’re sending your question is quite low. However, you can use the Discord search feature and hope that someone else has asked a similar question in the past and that it has been answered. It’s not the most user-friendly way to get answers but, in certain situations, it will be the only place that information is available so it’s good to know how to reach it.
One last thing I’d like to mention is, when an ecosystem is still young and under-documented, the best thing to do to help it grow is to contribute to it. When you’ve made such an effort to learn about it all and put all the pieces of the puzzle together, it would be a shame not to share it with others and make their introduction to web 3 that much less painful.
Contributing to Solana wallets
Speaking of contributing, once I knew how to create dApps in Solana, I spent a lot of time contributing to one of Solana’s core repositories: "wallet-adapter".
This repository provides JavaScript packages and UIs for integrating your application with almost all wallets that support Solana. However, I was surprised to see that they did not have a Vue version of their packages even though they had one for React and Angular. Being a Vue fan and determined not to work with the other frameworks, I decided to create a dApp that used a custom Vue version of their wallet adapters. I then saw they had an open issue to add support for Vue and I agreed to take on that task. Two weeks and three Pull Requests later, this repo now fully supports Vue and I couldn’t be prouder to have contributed to an ecosystem I knew nothing about a few weeks earlier.
Back to NFTs
Now that I was more confident with the Solana ecosystem, it was time to dig a bit more into the world of NFTs in Solana since that was my initial goal.
In almost every other blockchain, there is a standard called ERC-721 that defines how NFTs should be modelled in smart contracts and how the metadata should be provided in order for other applications such as wallets and marketplaces to display them properly.
Since Solana does not use Solidity, it cannot follow that standard. Instead, the standard was defined by Metaplex which is a set of Solana programs designed to help you create your own NFT marketplace that supports many features such as printing duplicated editions, auctions, etc.
Now I have to say, I have a lot of frustrations towards Metaplex and the main reason being that its main use-cases are pretty niche yet we have no other choice but to use it if we want our NFTs to be recognised by wallets and marketplaces. Chances are, the only thing you’re going to need from Metaplex is their "Token Metadata Program" and if you want to use this in isolation for your project, good luck. I have, however, managed to finally reach that point in a way that’s reusable and fully encapsulated in a Solana program so I will likely dedicate an entire article to it at some point to help others that might be stuck. That being said, I hope that, in the near future, either Solana will take over the Metaplex standard or Metaplex will make it easier to use their programs in isolation.
And that’s where I am now. I can create Solana dApps that generate NFTs following the Metaplex standard!
Now what?
Now I want to add additional custom data to my NFTs which can be used to make them interact with one another and keep track of their current state. Whilst most NFTs only need an array of properties with different probabilities that are store directly in the metadata, I’d like to have real data on-chain so I can treat NFTs like players or entities in a decentralised game.
Funnily enough, I don’t think this is going to be hard at all now that I know how Metaplex attach their standardised metadata to the NFT. I’d love to explain how all of this work in Solana but I want to keep this article focused on the journey rather than the low-level technical stuff which I’ll dedicate an entire article to.
After that, it will just be the case of implementing the logic of the game itself using these NFTs with storage as entities which is going to be super fun!
Conclusion
Whilst there is certainly a steep learning curve when entering the world of web 3, it has been a fun and exciting experience that I can only recommend to curious readers.
In addition, the decentralised ecosystem is growing day and day and more resources are constantly being released making it easier and easier to get started. Speaking of, if you’re interested in the Solana blockchain, there is a very promising course getting released soon focused on learning Solana by creating a dApp from scratch! I will definitely check it out as I’m sure I’ll learn a lot of new things from it. Also, if you’re more into Solidity and other blockchains, Buildspace has other courses for them too.
Finally, I’d like to mention that, if you do enter the world of web 3, there is an enormous contribution opportunity. So many things are not documented creating teaching opportunities. So many things can be improved in the open-source world making it possible to have a significant impact on the technology. So many things have not even been done yet and people will lose their minds when they get released. So come join the fun and leave your mark!