Subgraphs
Reading time: 1 min
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.
- 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 .
- Index & Query: Once a subgraph is indexed, anyone can query it. Explore and query all subgraphs published to the network in .
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
: code that translates event data into entities defined in your schema
To learn more about each of subgraph component, check out .
Here is a general overview of a subgraph’s lifecycle: