What is The Graph (GRT)?
The Graph ($GRT) is an indexing protocol for querying blockchain data for networks like Ethereum and IPFS by using a decentralized API system.
Previously, it is difficult to read advanced data directly from the blockchain, especially for those projects with complex smart contracts. For example, read operations like getting the owner of a certain NFT could be performed directly, while advanced operations like aggregation, search and non-trivial filtering are hard to be conducted. As a result, indexing blockchain data is of great difficulty.
The Graph solves this with a decentralized protocol that indexes and enables the performant and efficient querying of blockchain data. The APIs (indexed "subgraphs") can 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 does The Graph (GRT) work?
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.
The following diagram gives more detail about the flow of data once a subgraph manifest has been deployed, dealing with Ethereum transactions:
- Add data: A dApp adds data to Ethereum through a transaction on a smart contract.
- Emit events: The smart contract emits one or more events while processing the transaction.
- Scan: Graph Node continually scans Ethereum for new blocks and the data for your subgraph they may contain.
- Mapping: 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.
- Translate the GraphQL queries into quieris for the underlying data: When the dApp 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.
Who created Graph (GRT)?
The Graph protocol was launched in July 2018, cofounded by Brandon Ramirez, Yaniv Tal, and Jannis Pohlmann. Since January 2019, The Graph has been offering a hosted service with over 2,900 subgraphs for Web3 and DeFi apps. The idea of the Graph ecosystem was conceived and developed by Graph Protocol Incorporation, which was later renamed Edge & Node. Further in 2020, The Graph Foundation was announced to support the diverse network and the various network participants. Eva Beylin was nominated as the director of the foundation. She is experienced in financials, data, and business strategy and worked with OmiseGO and EF.