
Editor's Note: This article comes fromBlock beats BlockBeats (ID: BlockBeats), reprinted by Odaily with authorization.
Editor's Note: This article comes from
Block beats BlockBeats (ID: BlockBeats)
Block beats BlockBeats (ID: BlockBeats)
, reprinted by Odaily with authorization.
As long as we do anything online, data is generated all the time. At the end of each year, various annual lists such as payments, listening to songs, and takeaways are published in the circle of friends, all of which are traces of our interaction with the Internet.
This is also the reason for the emergence of API, Application Programming Interface, as the name suggests, is a software-to-software page that enables data exchange between applications. This seems to be a term exclusive to programmers, but it is actually closely related to daily life.
For example, we use WeChat to transmit information, or use market software to watch the market, all of which are connected to the Internet through mobile applications, and then interact with the database through the Internet. The database is responsible for unlocking and analyzing the required data, and after completing the instructions, the information we need is transmitted back to the mobile phone in a way that we can understand.
In the world of Internet giants such as Ali and Meituan, people have become accustomed to using APIs to save time in the Web2 world. In the world of Web3, interaction will also produce data, and the API in Web3 is equally important.
APIs in a Web3 world
Capital has already smelled this blue ocean.
Nansen raised a $1.2 million seed round led by Mechanism Capital and Skyfall Ventures, Dune Analytics raised a $2 million seed round led by Dragonfly Capital, and API providers like Glassnode have long since become the industry's most used data provider.
In the blockchain system, the data is encrypted and integrated into the block, and then connected into a chain and recorded in the distributed nodes. The data after the chain becomes a history that is extremely difficult to be changed. It is very difficult to use on-chain data in general.
First of all, the data on the chain is stored in a distributed network composed of thousands of nodes. From the perspective of data reading, the difficulty of reading distributed databases is far greater than that of centralized databases.
Secondly, the data on the chain is encrypted to varying degrees, which makes the data on the chain very difficult to parse. Not only that, because the data on the chain is arranged sequentially by blocks, generally speaking, the way to search for data on the chain is to start searching from the first block of the entire chain, and search in sequence according to the order of the blocks. This search process is Very inefficient.
Since Ethereum is the most mature ecosystem for on-chain applications, we take the data on the Ethereum chain as an example for analysis. Before The Graph appeared, there were usually two main ways to obtain data on the Ethereum chain: use Web3.js/ethers.js to obtain directly from the Ethereum node or build a centralized server to organize the data.
However, the above two solutions have their own disadvantages. If you choose a self-hosted server, you need a lot of hardware resources (running Archive Node), which is costly and difficult, and the server maintenance costs are huge.
If Web3.js/ethers.js is used to directly obtain data on the chain from the Ethereum node, the response time of the node to the request is long and the efficiency is low, and if the node service provider like Infura is used, the application will face a single point of failure risks of. Just on November 11, 2020, because Infura was not running the latest version of the Geth client, some special transactions triggered a bug in the old version of the client, which eventually caused many applications using Infura to temporarily go down.
Of course, there are also professional data API providers like Glassnode, Nansen, and Dune Analytics in the industry, all of whom are backed by top-level capital, which also proves the value of on-chain data and the importance of on-chain APIs.
However, the centralized service provider naturally retains the defects of the Web2.0 era, and all users who use the products of the centralized service provider will have the risk of being rent-seeking in the future. It is not advisable to solve the problems in Web3 in a centralized form, and it also makes decentralized applications not completely decentralized. If we want to completely solve the problem, we need a decentralized data middleware.
Decentralized data middleware The Graph
As the infrastructure for building completely decentralized applications, The Graph is mainly aimed at data query on the chain and the API layer of the decentralized network to solve the developer's trade-off between application performance and decentralization. Many people may not know that many well-known projects such as CoinGecko, CoinMarketCap, Messari, Delphi Digital, Zapper, Uniswap, Synthetix, PoolTogether, Livepeer, mStable, and Balancer have already started using The Graph to provide services.
The Graph node, which plays the role of a data indexer in the network, is also a core component of the network, providing indexing and query services for the network. Just like the nodes in the PoS network, node operators need to pledge GRT tokens, and they will also receive incentives for additional issuance of the network while obtaining query fees. Delegator can pledge GRT to the nodes it trusts to share revenue with the nodes without running the nodes.
Subgraph defines the data query logic for different applications. Since anyone can write Subgraph for different applications, the quality varies. The Graph node retrieves the highest quality Subgraph and uses its query service. Curator is the key to ensuring the quality of Subgraph. Curator will pledge GRT tokens to the Subgraph that it believes is of the highest quality and will be invoked most frequently and share its query fees.
Through the pledge of Delegator and Curator, an indexer market and a Subgraph market are formed in The Graph network, and market competition ensures the quality of data provided by The Graph.
Subgraph for everyone
All applications are producing various data all the time. As mentioned above, Subgraphs of different applications sort out the most commonly used data acquisition paths for retrieval nodes. At the time of writing, there are over 8000 different Subgraphs in The Graph network.
Let's take Uniswap, the decentralized trading platform with the largest trading volume, as an example. As can be seen in the figure below, the current status and historical data and prices of contracts can be tracked in Uniswap's Subgraph, including the summary data of trading pairs and the transaction value of each trading pair. And the separate data of tokens, transfer data within the contract, liquidity provider data, etc.
Through the nodes of The Graph, users can call Uniswap data to realize real on-chain search. Unlike other tools that can only see the information provided in the platform, The Graph allows users to actually search on the chain.
Each DApp will have multiple Subgraphs provided by different developers, and different Subgraphs will provide different data categories. The Graph node will index the corresponding, high-quality Subgraph according to the demand, and form Google on the chain.
How ordinary currency holders participate in The Graph network
There are three ways for GRT holders to participate in The Graph network: become a Delegator (a client), a Curator (manager) or run a node.
Becoming a Delegator is the easiest way to participate in The Graph network. Token holders only need to select a node in The Graph browser to pledge. Different nodes charge different fees, and currency holders choose according to their preferences. The difference from the PoS network pledge is that the Delegator in The Graph network does not have the risk of slashing, and the pledge income is directly proportional to the node income.
Compared with Delegator, it will be slightly more difficult for currency holders to participate in The Graph network as Curator. Since Curator is responsible for the screening of Subgraphs in the network, token holders need to consider the pros and cons of each Subgraph by themselves. Token holders print corresponding tokens by staking GRT into the Subgraph's bonding curve, and the tokens represent the token holder's dividend right to the Subgraph's query income. In the future, token holders will redeem the locked GRT by burning the income tokens.《On-Chain Data: A New Framework to Evaluate Bitcoin》Of course, if the currency holder has a certain understanding of node operation and maintenance, he can directly participate in the network by running The Graph node. The minimum amount of GRT required to stake to run a node is 100,000. Although the income of the node operator is much higher than that of the Delegator and Curator, the coin holder needs to run the Archive node of the retrieved chain while running The Graph node, so the cost will be greatly increased.
Unleash the Infinite Possibilities of the Web3 World