What’s The Graph?

I am assuming that if someone is reading this article, they have a basic understanding of blockchain and decentralized finance. I will explain what The Graph is and how it works. This will help you understand the mechanics under the hood, so you can decide if it’s suitable for your use case.This is especially useful from a web-2 developer’s perspective.

As everyone knows, blockchain is an immutable digital ledger that records transactions across many computers. Nowadays, as is well known, many DeFi applications are being built on top of the blockchain. When building an application on top of a blockchain, you will need data relevant to your application (your smart contract’s events). This is where The Graph comes in.

For now, let’s imagine we are not doing this programmatically and we did a few transactions on blockchain. Somehow we want to know our old transaction/event histories. We plan to go see them one by one like in the following image…

Of course not! We use ingestion services like Etherscan. Ingestion services work by ingesting every change to the blockchain, transforming the data format, and storing it in a database. You can see the illustration in the following image.

The issue with the process described above is that it’s not decentralized. We have to trust someone to store the data and if something goes wrong we are having a problem. Moreover, services like Etherscan are not tailored to the needs of a specific application.

That’s where The Graph comes in. The Graph is a decentralized protocol for indexing and querying data from blockchains. It makes querying blockchain data easier. You can assume it as you using a service which index the blockchain data. Like other people describe, The Graph is Google of blockchain.

In my opinion, to describe The Graph as a service that queries and indexes your blockchain data. Additionally, this service is run on a decentralized network.

The following is how The Graph economy work.

It would be great if you could check their official documentation, as I am also studying how it work.

Subgraph got quite a few roles. I will explain how does it work one by one and will explain overall.

Developer

Create a subgraph or use existing subgraphs in a dapp.

As developers, they can create a subgraph and use existing subgraphs in their apps. They will be creating a subgraph and defining which kind of data they want from the smart contract using subgraph.yaml file. Developers specify what they want inside the subgraph manifest, but who does the indexing of that data? Yes, Indexer will do.

Indexer

Operate a node to index data and serve queries.

Indexers are people who run a node to index data and serve queries. In my opinion, indexers play a very important role as they have to run servers that do indexing and serve the queries. To become indexer, there are certain requirements and rewards. You should read more about this in the docs for detailed information.

Curator

Organize data by signaling on subgraphs.

These are the people who knew about web3 and they want to help Indexers by choosing a project and providing GRT token as a proof of saying “This is a legit important subgraph please index this”. I assume that the developer who created the subgraph will also do this. That’s why I put curator/developer inside my diagram above.

Delegator

Secure the network by delegating GRT to Indexers.

These are people who don’t want to run or afford to run but they want to secure the network and get rewards. They stake their GRT to Indexers and support them.


That’s how The Graph works. I hope you understand the overall. Please let me know if you are not clear or have questions. And don’t forget to go check out their official documentation.

no responses for What’s The Graph?

    Leave a Reply