Suhail Kakar
Suhail Kakar

@SuhailKakar

11 Tweets 1 reads Jan 12, 2023
How does Web3 (decentralized applications) work?
Here is a complete guide to Web3 Architecture ↓
You have probably heard about Web3 and decentralization. Decentralization means you have the complete right to your own content. It means instead of centralized entities; ownership gets distributed amongst users. Every user that ownership over their content.
Now let's go through the architecture of a Web3 dApp and how it works.
The heart of Web3 dApps are smart contracts, they are programs that respond to events by executing business logic and they run on a Blockchain.
Think of a smart contract as a backend code, where the logic for the application happens. These smart contracts should be compiled into the binary format and then deployed on any blockchain. The complied file or ABI can be used in the front end to interact with smart contracts.
We also have EVM which executes the logic defined in the smart contracts. To get or post any data on the smart contract which is deployed on a blockchain, we should be using a Node. You can either deploy our own node or use any node providers such as Chinstack, and Alchemy.
Every Ethereum provider implements a JSON-RPC to connect to blockchain, and then you can read the stored data on blockchain. However if you want to store anything on blockchain, you need to submit a signature using your wallet.
Coming to storage, popular storage solutions are IPFS and Arweave. IPFS is a distributed file system for storing and accessing data which means instead of storing your files on a centralized database, IPFS stores them on a peer-to-peer network.
Now let's talk about querying the data. You can either use smart contract events with help of packages like ethers.js or you can use @graphprotocol.The Graph is an off-chain indexing solution that can help you query data in a much easier way. It uses GraphQL query language.
So, we have talked about many things such as Querying data, Signing transactions, storage, and providers but there is one more important thing that we need to consider. Scaling!!!
As you know Ethereum doesn’t scale properly. There are a few problems with Ethereum scaling, due to so many transactions, it is a bit slow and has high gas fees.
Here is where @0xPolygon comes in. Polygon is an L2 scaling solutionsthat is fast and cheap than Ethereum.
Conclusion
Of course, this is such an overview of it and it is just the beginning of Web3. I believe that we might see much better tooling in the future. I didn't mention anything about Oracles, because I have another separate thread for it, stay tuned :)

Loading suggestions...