Subgraphs

Reading time: 1 min

What is a Subgraph?

链到本节

A subgraph is a custom, open API that extracts data from a blockchain, processes it, and stores it so it can be easily queried via GraphQL.

Subgraph Capabilities

链到本节
  • Access Data: Subgraphs enable the querying and indexing of blockchain data for web3.
  • Build: Developers can build, deploy, and publish subgraphs to The Graph Network. To get started, check out the subgraph developer Quick Start.
  • Index & Query: Once a subgraph is indexed, anyone can query it. Explore and query all subgraphs published to the network in Graph Explorer.

Inside a Subgraph

链到本节

The subgraph manifest, subgraph.yaml, defines the smart contracts & network your subgraph will index, the events from these contracts to pay attention to, and how to map event data to entities that Graph Node stores and allows to query.

The subgraph definition consists of the following files:

  • subgraph.yaml: Contains the subgraph manifest

  • schema.graphql: A GraphQL schema defining the data stored for your subgraph and how to query it via GraphQL

  • mapping.ts: AssemblyScript Mappings code that translates event data into entities defined in your schema

To learn more about each of subgraph component, check out creating a subgraph.

Subgraph Development

链到本节
  1. Create a subgraph
  2. Deploy a subgraph
  3. Test a subgraph
  4. Publish a subgraph
  5. Signal on a subgraph

Subgraph Lifecycle

链到本节

Here is a general overview of a subgraph’s lifecycle:

Subgraph Lifecycle

编辑

上页
快速开始
下页
支持的网络
编辑