Skip to content

Commit 4bd4a86

Browse files
idalithbMichaelMacaulaybenface
authored
About The Graph Update (#929)
* Update website/src/pages/en/about.mdx --------- Co-authored-by: Michael Macaulay <[email protected]> Co-authored-by: Benoît Rouleau <[email protected]>
1 parent e7e724d commit 4bd4a86

File tree

1 file changed

+26
-38
lines changed

1 file changed

+26
-38
lines changed

website/src/pages/en/about.mdx

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,55 @@
11
---
22
title: About The Graph
3+
description: This page summarizes the core concepts and basics of The Graph Network.
34
---
45

5-
## What is The Graph?
6+
## Explanation
67

7-
The Graph is a powerful decentralized protocol that enables seamless querying and indexing of blockchain data. It simplifies the complex process of querying blockchain data, making dapp development faster and easier.
8+
### What is The Graph?
89

9-
## Understanding the Basics
10+
The Graph is a decentralized protocol for indexing and querying blockchain data. Its suite includes [Subgraphs](/subgraphs/developing/subgraphs/), [Substreams](/substreams/introduction/), [Token API BETA](/token-api/quick-start/), and tools like [Graph Explorer](/subgraphs/explorer/) and [Subgraph Studio](/subgraphs/developing/deploying/using-subgraph-studio/).
1011

11-
Projects with complex smart contracts such as [Uniswap](https://uniswap.org/) and NFTs initiatives like [Bored Ape Yacht Club](https://boredapeyachtclub.com/) store data on the Ethereum blockchain, making it very difficult to read anything other than basic data directly from the blockchain.
12+
The Graph supports [90+ blockchains](/supported-networks/), enhancing dapp development and data retrieval.
1213

13-
### Challenges Without The Graph
14+
### Why is Blockchain Data Hard to Query?
1415

15-
In the case of the example listed above, Bored Ape Yacht Club, you can perform basic read operations on [the contract](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code). You can read the owner of a certain Ape, read the content URI of an Ape based on their ID, or read the total supply.
16+
Reading onchain data from the blockchain (e.g., ownership history, metadata, relationships between assets) typically requires processing smart contract events, parsing metadata from IPFS, and aggregating data manually. This is very slow, complex, and resource-intensive.
1617

17-
- This can be done because these read operations are programmed directly into the smart contract itself. However, more advanced, specific, and real-world queries and operations like aggregation, search, relationships, and non-trivial filtering, **are not possible**.
18+
## Solution
1819

19-
- For instance, if you want to inquire about Apes owned by a specific address and refine your search based on a particular characteristic, you would not be able to obtain that information by directly interacting with the contract itself.
20+
### How The Graph Solves This
2021

21-
- To get more data, you would have to process every single [`transfer`](https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code#L1746) event ever emitted, read the metadata from IPFS using the Token ID and IPFS hash, and then aggregate it.
22+
The Graph simplifies the complex process of retrieving blockchain data through a global, decentralized network of Indexers that index Subgraphs. This infrastructure facilitates efficient, censorship-resistant query handling, allowing developers to build applications using blockchain data without the hassle of managing servers or custom indexing.
2223

23-
### Why is this a problem?
24+
Each Subgraph defines:
2425

25-
It would take **hours or even days** for a decentralized application (dapp) running in a browser to get an answer to these simple questions.
26+
- Which smart contracts to watch
27+
- Which events to extract
28+
- How to map event data into a queryable format using [GraphQL](https://graphql.org/learn/)
2629

27-
Alternatively, you have the option to set up your own server, process the transactions, store them in a database, and create an API endpoint to query the data. However, this option is [resource intensive](/resources/benefits/), needs maintenance, presents a single point of failure, and breaks important security properties required for decentralization.
30+
### [Building a Subgraph](/subgraphs/developing/creating/starting-your-subgraph/)
2831

29-
Blockchain properties, such as finality, chain reorganizations, and uncled blocks, add complexity to the process, making it time-consuming and conceptually challenging to retrieve accurate query results from blockchain data.
32+
1. Define a [Subgraph Manifest](/subgraphs/developing/creating/subgraph-manifest/) with data sources and mappings.
33+
2. Use [Graph CLI](https://github.com/graphprotocol/graph-tooling/tree/main/packages/cli) to deploy the manifest to IPFS.
34+
3. An [Indexer](/indexing/overview/) picks it up and starts indexing Ethereum blocks.
35+
4. Data becomes queryable via a [GraphQL endpoint](/subgraphs/querying/graphql-api/).
3036

31-
## The Graph Provides a Solution
37+
### Data Flow Overview
3238

33-
The Graph solves this challenge with a decentralized protocol that indexes and enables the efficient and high-performance querying of blockchain data. These APIs (indexed "Subgraphs") can then be queried with a standard GraphQL API.
39+
1. A dapp triggers a transaction on Ethereum by interacting with a smart contract.
3440

35-
Today, there is a decentralized protocol that is backed by the open source implementation of [Graph Node](https://github.com/graphprotocol/graph-node) that enables this process.
41+
2. As the transaction is processed, the smart contract emits one or more events.
3642

37-
### How The Graph Functions
43+
3. [Graph Node](/indexing/tooling/graph-node/) continuously scans the Ethereum blockchain for new blocks and filters for events relevant to a deployed Subgraph.
3844

39-
Indexing blockchain data is very difficult, but The Graph makes it easy. The Graph learns how to index Ethereum data by using Subgraphs. Subgraphs are custom APIs built on blockchain data that extract data from a blockchain, processes it, and stores it so that it can be seamlessly queried via GraphQL.
45+
4. When a matching event is identified, Graph Node executes the Subgraph’s mapping logic, which is a WASM module that transforms event data into structured entities. These entities are subsequently stored and indexed.
4046

41-
#### Specifics
42-
43-
- The Graph uses Subgraph descriptions, which are known as the Subgraph manifest inside the Subgraph.
44-
45-
- The Subgraph description outlines the smart contracts of interest for a Subgraph, the events within those contracts to focus on, and how to map event data to the data that The Graph will store in its database.
46-
47-
- When creating a Subgraph, you need to write a Subgraph manifest.
48-
49-
- After writing the `subgraph manifest`, you can use the Graph CLI to store the definition in IPFS and instruct an Indexer to start indexing data for that Subgraph.
47+
5. The dapp queries the Graph Node via a [GraphQL API](https://graphql.org/learn/), retrieving indexed data to render in the UI. Users can then take actions that generate new transactions, continuing the cycle.
5048

5149
The diagram below provides more detailed information about the flow of data after a Subgraph manifest has been deployed with Ethereum transactions.
5250

5351
![A graphic explaining how The Graph uses Graph Node to serve queries to data consumers](/img/graph-dataflow.png)
5452

55-
The flow follows these steps:
56-
57-
1. A dapp adds data to Ethereum through a transaction on a smart contract.
58-
2. The smart contract emits one or more events while processing the transaction.
59-
3. Graph Node continually scans Ethereum for new blocks and the data for your Subgraph they may contain.
60-
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.
61-
5. The dapp queries the Graph Node for data indexed from the blockchain, using the node's [GraphQL endpoint](https://graphql.org/learn/). 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 dapp displays this data in a rich UI for end-users, which they use to issue new transactions on Ethereum. The cycle repeats.
62-
6353
## Next Steps
6454

65-
The following sections provide a more in-depth look at Subgraphs, their deployment and data querying.
66-
67-
Before you write your own Subgraph, it's recommended to explore [Graph Explorer](https://thegraph.com/explorer) and review some of the already deployed Subgraphs. Each Subgraph's page includes a GraphQL playground, allowing you to query its data.
55+
Explore [Graph Explorer](https://thegraph.com/explorer) to view and query existing Subgraphs.

0 commit comments

Comments
 (0)