The Graph is a queering protocol for Blockchain data that allows completely decentralized applications to be built. The project was established in 2017 by a group of three software engineers who were disappointed by the Ethereum ecosystem's lack of tooling, which made developing decentralized applications difficult. The Graph went live in December 2020, after several years of development and several modifications. As one of the infrastructure protocols, The Graph can be difficult to understand, so let me first illustrate what indexing, the key principle behind The Graph, is.
In general, indexing reduces the time it takes to locate a certain piece of information. An index in a book is a real-life example; rather than searching through the whole book page by page to find a topic, we will find it much faster in the index, which is arranged alphabetically and has a guide to the particular page in the book. Database indexes are used in computer science to accomplish the same purpose by reducing search time. Indexes can greatly speed up queries by giving fast access to relevant rows in a table, rather than searching the whole database table several times to provide data to a SQL query.
Indexing is important when it comes to Blockchains like Ethereum. Let me illustrate why this is the case by describing how a standard Blockchain is constructed. A Blockchain is made up of blocks that each holds a transaction. Blocks are linked to each other to provide a chronological, irreversible history of what has happened on the Blockchain so far. Because of this nature, a better method to looking for a specific piece of data, such as a transaction, will be to start from block 1 and scan through all transactions in that block for a transaction. We moved to block 2 and continued our search if the data was not identified. As you would expect, this procedure would be ineffective. This is also why any famous Blockchain explorer, such as Etherscan, created their service for reading all of the data on the Blockchain and storing it in a database that allows for fast data retrieval.
This system is often referred to as ingestion services because they consume all of the data and translate it into a queryable format. While this method normally works, it necessitates trusting the company that supplies the data, which is inconvenient when developing entirely decentralized and permissionless apps. Furthermore, all private cryptocurrency companies who do not trust other APIs must develop their ingestion service, which results in a lot of duplication of effort. This is also why a decentralized Blockchain query protocol was needed, which is where The Graph comes in.
The Graph strives to be one of the most important key infrastructure initiatives for developing truly decentralized applications. It works on decentralizing the query and API layer of the decentralized platform (Web3) by eliminating an exchange that dApp developers currently have to make: whether to create a performant app or one that is genuinely decentralized. The protocol allows queering various networks, such as Ethereum or IPFS, by using the GraphQL query language, which allows one to define which fields we're interested in and what search parameters we'd like to use.
The Graph includes a subgraph explorer that makes it simple to locate subgraphs of common protocols including UniSwap, Compound, and Balancer. The UniSwap subgraph gives users access to a wealth of information, such as overall volume for all trading pairs since the protocol's inception, volume data per trading pair, and information on specific tokens or transactions.
Focusing on various network members is the simplest way to describe The Graph layout. Let's begin with the Indexers. The Graph's node operators are indexers. By staking GRT tokens and running a Graph node, they will access the network. Their primary role is to index significant subgraphs. Indexers are compensated for indexing subgraphs and for serving queries against those subgraphs. They can negotiate prices on their services as well. To hold prices down, each Indexer competes with other Indexers while still ensuring that their data is of the highest quality. This essentially establishes a marketplace for Indexers' services.
Indexers are queered by Consumers, who pay them for supplying data from various subgraphs. End-users, other web services, and middleware are also examples of Consumers.
Curators are another essential component of the network. They use their GRT tokens to indicate which subgraphs should be indexed. Curators may be either developer who wishes to ensure that their subgraph is indexed by Indexers or end-users who believe a subgraph is useful and worth indexing. Curators are financially rewarded for how famous a particle or subgraph becomes.
Delegators are another kind of network user. They stake their GRT on behalf of Indexers in exchange for a share of the rewards and fees paid to Indexers. Delegators are not needed to run Graph nodes.
Fishermen and Arbitrators are the last but not least. They are useful in the event of a disagreement, such as where an Indexer presents the Consumer with inaccurate results.
But, how do network members collaborate to build a decentralized and trustless system? Assume a new DEX has opened, and the project's team aims to make it easier for other applications to reach the exchange's historical volume and other data points. A Curator must intervene to signal that the new subgraph is worth indexing to inspire Indexers to index it.
We have two possibilities here: if the new exchange was a highly awaited project with a lot of promise, the current Curator would most likely step in and use the GRT tokens to signal the usefulness of the new subgraph; or if the new exchange was a highly anticipated project with a lot of potentials, The Curator would profit financially from their signaling. If the new exchange is not well received, the project's developers will become Curators and use their GRT to inspire Indexers. After that, the Indexers will take over and begin indexing the subgraph. Depending on how much data has to be indexed, this phase can take a few hours or even a few days.
Consumers can begin querying the subgraph once indexing is complete. Each Consumer query necessitates payment in GRT, which is handled by the query engine. The query engine also serves as a trading engine, determining which Indexers to do business with. The Graph uses payment channels between the Consumer and the Indexer to make this process go more smoothly. Disciplinary action will be started if the indexer produces wrong data.
The GRT token is a utility token that is used in the layout of The Graph network. Curators use GRT to indicate subgraphs that are worth indexing, as previously mentioned. Furthermore, Indexers stake it to keep their benefits in place. People who own GRT tokens but don't want to be Indexers but who do not want to operate the GRT node will become Delegators and win a portion of the Indexers' reward. In GRT, Consumers also pay for queries. The Graph had a 10 billion GRT token supply at launch, with new tokens being issued at a rate of 3% each year to pay indexing rewards. There's also a token-burning process in place, which is supposed to begin at about 1% of total protocol query fees. Venture capital firms became very interested in the Graph protocol, and many major names, including Coinbase, participated in their initial offering.
The Graph core team hopes to further decentralize the protocol by launching on-chain governance in the future, which will be known as The Graph Council. The protocol currently only supports indexing Ethereum, but multi-Blockchain support is one of the areas where further research is required. Other well-known projects, such as UniSwap and Synthetix, also use The Graph. Some also called The Graph "The Google of Blockchains," citing parallels between Google's indexing of websites and The Graph's indexing of Blockchains and decentralized apps.