Author’s note: I’m experimenting with the traditional B2B writing style, so expect to read it like you would from The Graph’s blog itself. While this article highlights how The Graph addresses an important problem, it’s also an introduction to anyone learning about The Graph for the first time.
Primer
The Graph is a decentralized indexing protocol that queries, indexes, organizes and stores data for anyone to use.
Introduction
Web3 is based on decentralization, allowing anyone to carry out trustless transactions on the blockchain. Although anyone can view these transactions as blocks on the blockchain, organizing and compiling the data is a different story.
Consider a business analyst who wants to write a research report evaluating how the smart contract of 50 lending protocols works. They would have to manually find the smart contract address, retrieve the contract's ABI, create a contract instance and function, and view and aggregate the results. This can take hours or even days to complete for a single protocol. Additionally, with new blocks being added to the blockchain constantly, this is a never-ending task.
The Graph simplifies this process by indexing the data into subgraphs and providing it for anyone to use.
The market’s need for organizing blockchain data
The blockchain is built on decentralization, which means that data is stored on a distributed network of nodes instead of a central location. Unfortunately, this makes it difficult to query and retrieve the data and present it in an accessible manner. As of August 2022, there are 4,073 decentralized applications (dApps) on all blockchains, with Ethereum currently supporting 332 dApps, generating large volumes of data that need to be analyzed to gain company insights, study user behavior, and make informed decisions.
The Graph solves three important problems by aggregating and presenting the data in an accessible format:
Founders can build fast—and launch faster.
Businesses and organizations can make more informed decisions.
It maintains the trust and integrity users have in the blockchain industry.
Blockchain data is immutable, which means that it cannot be changed once its stored. It is crucial to store the data accurately to enhance its ability to support a vast number of applications and users. Accessible blockchain data is a necessity for the growth of the industry. The Graph provides decentralized and reliable access to this data, but how does it query the data?
The Graph ecosystem
Maintaining a decentralized and open-source protocol while efficiently indexing data is not an easy task. The Graph ensures its smooth operation and economic integrity by incentivizing ecosystem participants who process and store data in subgraphs, enabling them to respond to queries.
To understand how The Graph operates, the following is a list of key participants involved in the data query process:
Indexers: Indexers are responsible for operating graph nodes to process and store on-chain data. They stake The Graph's native token $GRT and select subgraphs to index. Indexers earn indexing rewards and query fee rebates for serving queries on the network. To participate in the network, an indexer must stake a minimum of 100k $GRT.
Curators: Curators analyze and signal to indexers which subgraphs are valuable to index. They earn 10% of all the query fees generated by the subgraph.
Delegators: Delegators delegate $GRT to indexers and earn a portion of the Indexer's query fees and rewards. This is a non-technical role in The Graph ecosystem and does not require running graph nodes.
Arbitrators: Arbitrators resolve disputes and determine if Indexers are acting maliciously.
The Graph has 420+ Indexers, 2,500+ Curators, 11,000+ Delegators and 620+ subgraphs live on the decentralized network. The Graph processes 1+ billion queries per day with a query success rate of 99.98%. Over 2 million $GRT in query fees have been claimed by indexers.
Many Web3 companies leverage subgraphs to improve and scale their operations. Messari for instance builds subgraphs to provide its users with accurate data reports and analytics, and Request Finance uses subgraphs to improve payment features on its platforms.
The Graph’s query market architecture
The flow for users that want to process a query is as follows:
Service Discovery: The consumer (e.g. a decentralized protocol) explores The Graph Network’s Service Discovery Layer to find Indexers that have the data they need.
Indexer Selection: The consumer selects an Indexer to query the data from a list provided by the Service Discovery Layer.
Query + Conditional Micropayment: The consumer sends the Indexer a query and conditional micropayment that states how much they are willing to pay for bandwidth and compute. The query includes the subgraph they want to query, the data they want to compute and the block from which they need it.
Response + Attestation: Once the Indexer accepts the price, they will process the query. The consumer will receive the resulting data and an attestation to prove the data is correct. Each attestation is unique to the Indexer and unlocks the conditional micropayment.
A consumer can query multiple subgraphs from different Indexers, but the user flow stays the same regardless.
Summary
The Graph represents a significant step forward in the development of decentralized infrastructure for Web3, but it is not without its limitations. For instance, The Graph’s architecture is hosted on the Ethereum network, limiting the protocol’s scalability. To solve this, The Graph Foundation in August 2022 launched the Multi-chain Incentivized Programs (MIPs): a six-month incentive program that aims to fund Indexers interested in supporting new chains on the decentralized network.
Despite its limitations—and its growth, The Graph has processed over 1 billion queries per day with a query success rate of 99.98%. It is empowering developers to build important dApps, and is rightly termed the Google of blockchain data. As its ecosystem continues to grow, we can expect to see more innovation in the Web3 space.
Till next time, have a lovely day.