Web3.0 architecture is not only decentralized, but also modular
Author: Xiang|W3.Hitchhiker
First, Web 2.0 Architecture
, Binance allows users to trade various tokens.
Binance is a Web 2.0 application, the architecture sounds simple, but in fact, in development, a lot of work is required.
Users need to connect the device to the Internet through the network operator, then open the browser, enter the Binance domain name, and access the Binance website through the http protocol.
Binance requires users to register and log in to the platform via mobile phone or email.
Then Binance needs a place to store basic data like user registration information, transaction amount, transaction history, pending orders, etc. And these all need to build a database for storage, and to constantly update.
Secondly, the backend code language (like Node.js, Java, or Go) determines all the business logic of Binance. You need a logic to build a server to deploy the backend and run the backend. For example, when a new user registers and trades, what happens to the pending order?
Also, things like front-end code languages (JavaScript, HTML, and CSS) determine Binance's UI logic. You need an interactive logic to build a server and deploy it to the front-end to run the front-end. For example, what does the website look like? What happens when the user interacts with each key on the page?
When you write a transaction on Binance, all these things are integrated and linked together. You interact with its front end, the front end interacts with the back end, and the back end interacts with its database. All of this code is hosted on a centralized server and fed back to users via an internet browser, and all control of the centralized server is in the hands of Binance.
This is a brief summary of how most Web 2.0 applications work today, although the reality is more complex.
Second, Web 3.0 Architecture
Web 3.0 application to Uniswap for example, Uniswap is a decentralized exchange that allows freely adding and trading various tokens.
Uniswap is a Web 3.0 application. The architecture sounds complicated, but the actual development and implementation are very simple.
First of all, if the user wants to connect to the Internet through the device, he needs to go through a network service provider, such as telecommunications and mobile. (Decentralized Internet Service Provider, Internet of Things: Helium)
Then, the user accesses the program through the browser or the operating system (Decentralized browser or operating system: Brave)
The user access program needs to interact with the server through the browser, and this operation needs to be performed through a protocol. Support (traditional is http, the new one can be replaced by IPFS, through content addressing)
Uniswap requires users to log in via private key and wallet<(similar to plugins, wallets, etc.: Metamask, Tokenpocket, Math, Brave wallet), in addition, unified DID is also a direction in the future (similar to ENS, etc.)
The wallet needs to be connected to the node of the blockchain, then the server of the node will need to provide it, which also requires the node of the corresponding blockchain, or by Infura/Alchemy This is done by a professional node service provider. (Decentralized node service providers are also a trend: Pocket)
What Uniswap website looks like when users interact with each other on the page What happens when a keystroke interacts? Or front-end code languages like JavaScript, HTML, and CSS implement Uniswap's UI logic.
But Web3 does not need to build a server to deploy and run the front-end interaction logic. These front-end data can be stored in a decentralized storage network. (eg Filcoin, SWARM, AR, etc.)
The following is the official IPFS link of Uniswap, this solution does not need to build a front-end server, users can also Normal use.
ipfs://bafybeiagkgmmhux6fswdoedmwqqsvt5arjivl35wuk25jljb2yqgn7njgu/#/swap
The above link can be seen from ipfs:// So you need a browser that supports parsing ipfs to open (Brave, Opera)
and the link is not human readable, so A domain name service is required to map the corresponding domain name to this link, such as uniswap.eth. (Decentralized Domain Name Service: IPNS, ENS, etc.)
Of course, IPFS only supports Http-compatible gateways to access.
Uniswap Interface
When website traffic is high, more flexible bandwidth is required Marketplace - CDN Accelerated Network. (CDN service, IPFS, Filecoin retrieval market)
Uniswap is implemented through blockchain smart contract language solidity, etc., which determines all Uniswap business logic. Because it runs in the EVM environment, Uni does not need to build its own server to deploy the backend to run business logic (blockchain that supports smart contracts, ETH etc.).
However, what the exchange needs to display is definitely not only the business logic, but also the historical price curve of the currency price, transaction quota, etc. These historical data cannot be obtained through smart contracts. Assuming that the project party needs to display, it still needs to build a server by itself, run a node, and filter out the data on the chain and save it to Uni's own database. So Web3 needs a solution for chain data indexing. (Chain data indexing platform Graph)
The Graph provides a chain data indexing scheme, which can facilitate users to query data. In The Graph, you can define which smart contracts need to be indexed, which events and function calls need to be monitored, including the state when they are called and generated, and how to convert incoming events into front-end logic that can be processed.
The data on the chain will be saved by a special Graph index mining node, which will provide API for user page calls. The project party does not need to build a server, only The index node needs to build a server to run the index data mining node.
By indexing blockchain data, The Graph allows us to query on-chain data in application logic with almost no latency.
For example, the presentation of Uniswap transaction information is generated by The Graph.
Uniswap Info
If Uniswap wants to show more, put the coins under the chain The price data is also presented on the chain. At this time, it is necessary to open up the bridge of the data on the chain under the chain (decentralized oracle: chainlink).
According to the above development logic, Uniswap is equivalent to publishing a Web 3.0 application, but the actual implementation cost is much lower than the cost of developing Binance Exchange, because:
Uniswap does not require users to bind their mailboxes and mobile phones, they can log in directly through the wallet, and Uni itself does not need to be saved
Uniswap does not need to build a front-end server, users can access it through IPFS or AR storage front-end page
< No need to build a backend server. The back-end logic runs on smart contracts
There is no need to build a database, historical data and database operations are implemented through TheGraph
Professional people do professional things, Uniswap only needs to do well and design its own logic, and other logics are supported by the modular Web3 infrastructure.
Uniswap not only achieves complete decentralization, but also a simple application case of Web3 modularization.
The core of Web3 is to de-trust the interactive value. The development of modularization can not only achieve de-trust, but also improve the efficiency of operation. The trend of modularization will be applied to all walks of life.
What I mentioned above is the modularization of the Web3 network architecture, which improves the productivity of Web3. Mainly, Web3's generative relationship is DAO, and the modularization of DAO is also a future trend). DAO relies on the blockchain, and the blockchain itself is also moving towards modularization. The same is true for the metaverse, games, and so on.
The arrival of the modular era will bring higher efficiency and better services. W3Hitchhiker will continue to follow up the modularization of crypto.
source: Web3.0 architecture is not only decentralized, but also modular
评论
发表评论