Subgraphs

Reading time: 1 min

What is a Subgraph?

Collegamento a questa sezione

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

Collegamento a questa sezione
  • 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

Collegamento a questa sezione

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

Collegamento a questa sezione
  1. Create a subgraph
  2. Deploy a subgraph
  3. Test a subgraph
  4. Publish a subgraph
  5. Signal on a subgraph

Subgraph Lifecycle

Collegamento a questa sezione

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

Subgraph Lifecycle

Modifica pagina

Precedente
Quick Start
Successivo
Supported Networks
Modifica pagina