The Graph

What The Graph Is ?

The Graph is a decentralized protocol for indexing and querying data from blockchains, starting with Ethereum. It makes it possible to query data that is difficult to query directly.

Projects with complex smart contracts like Uniswap and NFTs initiatives like Bored Ape Yacht Club store data on the Ethereum blockchain, making it really difficult to read anything other than basic data directly from the blockchain.

In the case of Bored Ape Yacht Club, we can perform basic read operations on the contract like getting the owner of a certain Ape, getting the content URI of an Ape based on their ID, or the total supply, as these read operations are programmed directly into the smart contract, but more advanced real-world queries and operations like aggregation, search, relationships, and non-trivial filtering are not possible. For example, if we wanted to query for apes that are owned by a certain address, and filter by one of its characteristics, we would not be able to get that information by interacting directly with the contract itself.

To get this data, you would have to process every single transfer event ever emitted, read the metadata from IPFS using the Token ID and IPFS hash, and then aggregate it. Even for these types of relatively simple questions, it would take hours or even days for a decentralized application (dapp) running in a browser to get an answer.

You could also build out your own server, process the transactions there, save them to a database, and build an API endpoint on top of it all in order to query the data. However, this option is resource intensive, needs maintenance, presents a single point of failure, and breaks important security properties required for decentralization.

Indexing blockchain data is really, really hard.

Blockchain properties like finality, chain reorganizations, or uncled blocks complicate this process further, and make it not just time consuming but conceptually hard to retrieve correct query results from blockchain data.

The Graph solves this with a decentralized protocol that indexes and enables the performant and efficient querying of blockchain data. These APIs (indexed "subgraphs") can then be queried with a standard GraphQL API. Today, there is a hosted service as well as a decentralized protocol with the same capabilities. Both are backed by the open source implementation of Graph Node.

How The Graph Works?

The Graph learns what and how to index Ethereum data based on subgraph descriptions, known as the subgraph manifest. The subgraph description defines the smart contracts of interest for a subgraph, the events in those contracts to pay attention to, and how to map event data to data that The Graph will store in its database.

Once you have written a subgraph manifest, you use the Graph CLI to store the definition in IPFS and tell the indexer to start indexing data for that subgraph.

This diagram gives more detail about the flow of data once a subgraph manifest has been deployed, dealing with Ethereum transactions:

The flow follows these steps:

  1. A decentralized application adds data to Ethereum through a transaction on a smart contract.

  2. The smart contract emits one or more events while processing the transaction.

  3. Graph Node continually scans Ethereum for new blocks and the data for your subgraph they may contain.

  4. Graph Node finds Ethereum events for your subgraph in these blocks and runs the mapping handlers you provided. The mapping is a WASM module that creates or updates the data entities that Graph Node stores in response to Ethereum events.

  5. The decentralized application queries the Graph Node for data indexed from the blockchain, using the node's GraphQL endpoint. The Graph Node in turn translates the GraphQL queries into queries for its underlying data store in order to fetch this data, making use of the store's indexing capabilities.The decentralized application displays this data in a rich UI for end-users, which they use to issue new transactions on Ethereum. The cycle repeats.

Network Overview:

The Graph Network is a decentralized indexing protocol for organizing blockchain data. Applications use GraphQL to query open APIs called subgraphs, to retrieve data that is indexed on the network. With The Graph, developers can build serverless applications that run entirely on public infrastructure.

GRT Token Address: 0xc944e90c64b2c07662a292be6244bdf05cda44a7


The Graph Network consists of Indexers, Curators and Delegators that provide services to the network, and serve data to Web3 applications. Consumers use the applications and consume the data.

To ensure economic security of The Graph Network and the integrity of data being queried, participants stake and use Graph Tokens (GRT). GRT is a work token that is an ERC-20 on the Ethereum blockchain, used to allocate resources in the network. Active Indexers, Curators and Delegators can provide services and earn income from the network, proportional to the amount of work they perform and their GRT stake.

Define a Subgraph

A subgraph defines which data The Graph will index from a blockchain, and how it will store it. Once deployed, it will form a part of a global graph of blockchain data which you can retrieve using GraphQL.

The Graph R&D Roadmap:


An integral part of continuing to push decentralization of The Graph is decentralizing the way teams collaborate on core elements of the protocol. To make it easier for teams developing The Graph to collaborate cross-functionally, R&D working groups were created for distinct focus areas. The Graph is a core component of the web3 stack, and the working groups cover key areas of the protocol that web3 developers rely on.

There are 5 distinct working groups that make up the focus areas of the roadmap:

  1. Data & APIs

  2. SNARK Force

  3. Protocol Economics

  4. Protocol & Network Operations

  5. Indexer Experience

These working groups enable teams in The Graph community to contribute to different components of the protocol in parallel and scale coordination more efficiently. There are also many dependencies across working groups, where outcomes unlock efforts for others (illustrated below by the connecting arrows).

Link to roadmap :


GRT, the native token of the graph protocol has the following utilities attached to it:

  • GRT is used as a work token that is locked up by curators, indexers and delegators

  • Medium of exchange and queries paid in GRT

  • Protocol burns GRT from supply using a percentage of fees

Consensus Mechanism


Indexers are the node operators of The Graph network. In order to join the network, indexers need to stake The Grapphโ€™s native token, GRT, and run a node. Their primary function is to index relevant subgraphs and process queries. For these services indexers earn query fees and indexing rewards. Query fees are handled through a recently launched microtransaction system called Scalar, which facilitates direct payments to indexers via state channels. Meanwhile, indexing rewards are generated via a 3% protocol-wide annual inflation.


These are network participants that signal to Indexers which subgraphs should be indexed by the network. The way this works is that they deposit GRT into a bonding curve to signal on a specific subgraph and earn a portion of the query fees for the subgraphs they signal on.

DApp developers, data consumers and other community members can all be curators and use their knowledge about the Web3 space to assess subgraphs. Notably, the indexing reward for a specific subgraph depends on the number of curator signals it has received, meaning that the more popular a subgraph is, the higher its reward is.


Delegators are people who can participate in the network by delegating stakes to Indexers. In this way, people who donโ€™t want to run their own nodes can still contribute to the network and earn GRT, as they receive a portion of the query fees and indexing rewards of the Indexers they have delegated to. Delegators have to pay a 0.5% fee every time they delega

Last updated