So what is The Graph Protocol all about? Why do some people call it the Google of Blockchains? And what is the use case for the GRT token? You’ll find answers to these questions in this article.
Let’s start with what The Graph actually is.
The Graph is an indexing protocol for querying blockchain data that enables the creation of fully decentralized applications.
The project was started in late 2017 by a trio of software engineers who were frustrated by the lack of tooling in the Ethereum ecosystem which made building decentralized applications hard. After a few years of work and a lot of iterations, The Graph went live in Dec 2020.
The Graph, as one of the infrastructure protocols, can be quite tricky to grasp, so before we jump into the details, let’s try to understand what indexing – the main concept behind The Graph – actually is.
Indexing, in essence, allows for reducing the time required to find a particular piece of information. A real-life example is an index in a book. Instead of going through the whole book page by page to find a concept we’re looking for, we can find it much quicker in the index, which is sorted alphabetically and it contains a reference to the actual page in a book.
Similarly, in computer science, database indexes are used to achieve the same goal – cutting the search time. Instead of scanning the whole database table multiple times to provide data to an SQL query – indexes can dramatically speed up queries by providing quick access to relevant rows in a table.
When it comes to blockchains such as Ethereum, indexing is super important. To understand why this is the case, let’s see how a typical blockchain is built.
A typical blockchain consists of blocks that contain transactions. Blocks are connected to their adjacent blocks and provide a linear immutable history of what happened on the blockchain to date.
Because of this design, a naive approach for searching for a particular piece of data, such as a transaction, would be to start with Block 1 and search for a transaction across all transactions in that block. If the data is not found we move to Block 2 and continue our search.
As you can imagine this process would be highly inefficient. This is also why every popular blockchain explorer, such as Etherscan, built their own service for reading all the data on the blockchain and storing it in a database in a way that allows for quick retrieval of data.
These kinds of services are very often called ingestion services as they basically consume all the data and transform it into a queriable format.
Although this approach usually works fine, it requires trusting the company that provides the data – this is not ideal for building fully decentralized and permissionless applications.
On top of that, all private crypto companies that don’t want to trust other APIs have to build their own ingestion service which creates a lot of redundant work.
This is also why a decentralized query protocol for blockchains was needed and this is where The Graph comes into play.
The Graph aims at becoming one of the main core infrastructure projects necessary for building fully decentralized applications. It focuses on decentralizing the query and API layer of decentralized web (Web3) by removing a tradeoff that dApp developers have to make today: whether to build an app that is performant or truly decentralized.
The protocol allows for querying different networks such as Ethereum or IPFS by using a query language – GraphQL. GraphQL allows for specifying which fields we’re interested in and what search criteria we would like to apply.
Queriable data is organised in the form of subgraphs. One decentralized application can make use of one or multiple subgraphs. One subgraph can also consist of other subgraphs and provide a consolidated view of data that the application may be interested in.
The Graph provides an explorer that makes it easy to find subgraphs of the most popular protocols such as Uniswap, Compound, Balancer or ENS.
Uniswap subgraph provides access to a lot of useful data, for example, the total volume across all trading pairs since the protocol was launched, volume data per trading pair and data about particular tokens or transactions.
Now, let’s jump into the architecture of The Graph Protocol.
The Graph Architecture
The easiest way to explain this is to focus on different network participants first.
Let’s start with Indexers.
Indexers are the node operators of The Graph. They can join the network by staking the GRT tokens and running a Graph node. Their main function is to index relevant subgraphs. Indexers earn rewards for indexing subgraphs and fees for serving queries on those subgraphs. They also set prices for their services. To keep prices in check each Indexer competes with other Indexers, on top of ensuring the highest quality of their data. This basically creates a marketplace for the services provided by Indexers.
Consumers query Indexers and pay them for providing data from different subgraphs. Consumers can be either end-users, other web services or middleware.
Curators are other important network participants. They use their GRT tokens to signal what subgraphs are worth indexing. Curators can be either developers that want to make sure their subgraph is indexed by Indexers or end-users that find a particular subgraph valuable and worth indexing. Curators are financially incentivised as they receive rewards that are proportional to how popular a particular subgraph becomes.
Delegators are yet another network participant. They stake their GRT on behalf of Indexers in order to earn a portion of Indexers’ rewards and fees. Delegators don’t have to run a Graph Node.
Last but not least are Fishermen and Arbitrators. They become useful in case of a dispute that can happen, for example, when an Indexer provides incorrect data to the Consumer.
Now, let’s see how the network participants cooperate in order to create a trustless and decentralized system.
Let’s say a new decentralized exchange has launched and the team behind the project wants to allow other applications for easy access to the exchange’s historical volume and other data points.
To encourage Indexers to index the new subgraph, a Curator has to step in and signal that the new subgraph is worth indexing.
Here we have 2 options. If the new exchange was a highly anticipated project with a lot of potential, an already existing Curator would most likely step in and use their GRT tokens to signal the usefulness of the new subgraph. If the subgraph becomes popular, the curator would financially benefit from their signalling. In the case that the new exchange is not highly anticipated, the developers behind the project can become Curators themselves and use their GRT to encourage Indexers.
Once this happens, the Indexers can step in and start indexing the subgraph. This process can take a few hours or even a few days depending on how much data has to be indexed.
Once indexing is completed, the Consumers can start querying the subgraph. Each query issued by the consumers requires payment in GRT that is handled by the query engine. The query engine also acts as a trading engine, making decisions such as which Indexers to do business with.
To make this process smoother, The Graph uses payment channels between the Consumer and the Indexer. If the Indexer provides incorrect results a dispute process can be initiated.
If you’d like to dive deeper into the architecture behind The Graph protocol, you can check this link here.
Now, time to discuss the GRT token.
The GRT Token
GRT is a utility token that plays an important role in The Graph Network design. As we mentioned earlier GRT is used by Curators to signal subgraphs that are worth indexing. On top of this, it’s staked by Indexers to keep their incentives in check. Besides that, people who own GRT tokens, but don’t want to be Indexers and run the GRT node, can become Delegators and earn a portion of Indexers reward. And also, Consumers pay for their queries in GRT.
The Graph had an initial supply of 10 billion GRT tokens and new token issuance at 3% annually that is used for paying the indexing rewards.
There is also a token burning mechanism that is expected to start at ~1% of total protocol query fees.
The Graph protocol had a huge interest from VCs, with plenty of big names including Coinbase Ventures participating in their initial offering.
The Graph core team aims at decentralizing the protocol further by launching on-chain governance – The Graph Council – in the future.
The protocol that is currently deployed to Ethereum mainnet only supports indexing Ethereum, but multi-blockchain support is one of the areas for further research.
The Graph is already used by other popular projects such as Uniswap, Synthetix, Decentraland and Aragon.
It looks like The Graph could be one of the missing puzzles in the effort of increasing the decentralization of dApps.
Some people went as far as calling The Graph the Google Of Blockchains, pointing at similarities between indexing websites by Google and indexing blockchains and decentralized applications by The Graph.
If this analogy is correct, and The Graph indeed becomes a go-to protocol for indexing web3, it has a lot of potential to grow.
So what do you think about The Graph? Will it become a core piece of infrastructure in the decentralized world?