There are a lot of different concepts in Web3 development that may be hard to understand, as this technology is kind of new, and not so many people understand it well.
We will discuss different concepts That you will face if you are a Web3 developer, here are the concepts that we are going to explain:
- Node Provider
- Web3 API
- Storage Provider
- Querying and Indexing
In this article, we will explain each of these concepts, and we will try to make it easy to understand by new developers and even non-developer Web3 enthusiasts.
The first concept you may face when developing your first Dapp is the node provider, you can’t make any Dapp or smart contract without a node provider, but what is a node provider?
In Web2 technology when you are building a website or mobile application, you need a database to store different information like usernames, emails, passwords, etc. But how can you access this database?
To access the database there are two options, you should have the database locally on your computer in order to access it, or you can run it on another computer (cloud solutions) and take an API to have access to it.
The blockchain stores data in a Distributed Ledger, which means it is like one database that is controlled by more than one computer, how we can access this database in this situation?
The answer is like the way we mentioned in the Web2 technology example, you need to install the database locally or run it on the cloud.
The problem here is that blockchain size is so big, Ethereum size is about 0.75 Terabytes, at the time of writing this article. This is just the size of the data stored, so it's hard to deal with it locally.
Node providers come into play to solve this problem, You can think of node providers as cloud solutions for blockchain, where the companies that provide this service are running nodes on their servers, and you can take their API to connect to the blockchain database, it's exactly like Web2 technology.
Node providers offer a node for not just one blockchain, they are running nodes for different blockchains, so you can connect to Ethereum blockchain as well as Binance Smart Chain, with the same company. This solved the problem of how to access the blockchain database.
There are a lot of different node providers, and we will list some of the popular ones:
Ethereum blockchain size chart
Another concept you may face is Web3 API, Web3 APIs are powerful tools that can make your Dapp more professional and improve its user experience a lot.
Web3 API is an easy way to get data stored in the blockchain, whereas in blockchain it’s hard to get some data stored in it, and it will take too much time to trigger this data.
For example, imagine you are building an NFT marketplace, and you want to list all the NFTs owned by the user when he connects to the market. This approach is hard to achieve using a normal blockchain database, as you will search for all NFT addresses, and this will take so much time.
Web3 APIs store the data that is more used in blockchain space in servers, so instead of searching for a needle in a haystack, these APIs will give you the data faster.
Another example is ERC20 tokens, It will be so hard to get all ERC20 smart contract that is created using the blockchain. Web3 APIs can help you get all ERC20 tokens (even the ones you don't know) easily and faster.
You may say, that’s a great and helpful tool, but how do these APIs work, and how can they provide that data?
The answer is simple, Companies that provide Web3 APIs are running nodes on their servers, but instead of providing these nodes to users to use, they are running the blockchain database, and when a given smart contract is deployed for example ERC20 contract they store this contract address in their servers, so these companies will have all ERC20 contract addresses that are created.
Node provider companies can also provide Web3 APIs like Alchemy.
There are different kinds of Web3 APIs that you may use, for example:
- NFTs API: used to get different information about ERC721 and ERC1155.
- Token API: used to get ERC20 token information.
- Wallet API: used to get wallet information, transactions, balance, etc…
- DeFi API: used to get information for DeFi projects like Uniswap, Aave, and Compound.
There are a lot of different Web3 API providers, and we will list some of the popular ones:
In Web2 technology, users use their emails to interact with different applications, but in Web3 the case differs.
In order to interact with the blockchain you need to have a private key that represents your password, and a public key that is like your public username.
With these keys, you can interact with the blockchain, but it's hard to interact with just these keys, you need an easy way to interact with the blockchain and this is where wallets come into play.
Wallets store your private key, and make it easy for you to interact with the blockchain, removing the complicated cryptographic concepts, and hashing that validates your identity.
These Wallets are also known as Signers.
Signers make it easy for users to interact with the blockchain and Dapps, which makes signing messages easy and provides a better user experience.
In blockchain you need to provide a signature using your private key and send it to the blockchain in order to do a transaction, This signature is validated by nodes, and if it’s validated it is added to the block. Once the block is validated, It is added to the blockchain, and your transaction will be completed.
These operations are hard for non-developers, so crypto wallets which are also known as signers for developers make these steps easier. They provide a UI, and with just a button click you sign the transaction and send it to the blockchain, and once it's confirmed the wallet may alert you.
You will use Signers if you are building a Dapp (front-end and the smart contract), where you will need to test how users will interact with your smart contract.
There are a lot of different Signers, and we will list some of the popular ones:
- Metamask: used for developing purposes.
- CoinBase Wallet: used by beginners.
- Trust Wallet: used for mobile usage.
Now we will explain why you need a storage provider, and how it differs from normal storage solutions that are provided by AWS, or Google Cloud.
If you are going to make a Minting application, you will need a place where you can store NFT items images, and metadata.
This kind of data (images) are stored in a storage in Web2 technology, where cloud providers such as AWS and Google Cloud have Storage where you can use it, and you also use separate storage provider such as Cloudinary.
You can use these storage providers to store your images, but this is not the best practice.
In blockchain, we store smart contract logic in a decentralized way, so users can be reassured that it is not controlled by a single authority. It is better to store images and metadata in a decentralized way too.
Storage providers come into play to solve this problem, where it allows users to store data, and images in a decentralized way, so users will be reassured when their NFTs are stored in a decentralized way and are not controlled by a single authority.
Here is a list of some decentralized storage solutions:
Querying and Indexing
The last concept we will discuss in this article is querying and indexing, This concept may be hard to understand at first, so don’t get disappointed if you don’t understand it well the first time.
In the NFT marketplace as an example, when a user buys an item, it will transfer money to the seller and the NFT to the buyer, but there are some other details that you may need to know like time, item price changing, if the item was on auction, you will need to know bidders information. This kind of information is a lot and it's not stored in the blockchain in most cases, as it will cost so much money for the transaction, and it will not add anything to the logic of the smart contract.
Smart contracts are the logic of buying and selling NFTs (in the NFT marketplace example), We don’t store a lot of information in the blockchain as the more storage you use the more money you will have to pay. For this reason, developers store the logic only in the blockchain.
Since developers store only the logic, they will not have a way to get other related data, What will they do?
Developers make events after function execution. For example, when a user buys an item an event for buying will be fired. Then, they listen to these events using nodes and once the event occurs they take the data, add the additional information they want like time, and store it in a separate database.
Now, developers can get buying history with all the data needed. By querying the database to get information, we provide a better user experience for the users.
Did you notice the problem? DATABASE!
Developers use a database, which means a central point of authority. As we said it's better to make everything decentralized to make users reassured, here is where Querying and Indexing protocols come into play.
Querying and Indexing protocols let developers store the excess data they need using their protocols, and it provides an easy and fast way to get all these data in a decentralized way.
For example, you can query the buying history or selling history of your NFT marketplace, using these protocols. Users will be reassured, as everything is decentralized.
One of the most popular protocols for indexing and querying blockchain data is TheGraph.
We reached the end of our article, There are other concepts in Web3 development, but these are the popular ones.
Feel free to comment if there is a misunderstanding, or if there is something wrong with the article.
Understanding different Web3 development concepts was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.
#Understanding #Web3 #development #concepts