Skip to main content

Overview

The subgraph manifest specifies all the information required to index and query a specific subgraph. This is the entry point to your subgraph. The subgraph manifest, and all the files linked from it, is what is deployed to IPFS and hashed to produce a subgraph ID that can be referenced and used to retrieve your subgraph in The Graph.
Spec Version: v.0.0.4

Format

Any data format that has a well-defined 1:1 mapping with the IPLD Canonical Format may be used to define a subgraph manifest. This includes YAML and JSON. Examples in this document are in YAML.

Top-Level Fields

String
required
A Semver version indicating which version of this API is being used.
Schema
required
The GraphQL schema of this subgraph. See Schema for details.
String
An optional description of the subgraph’s purpose.
String
An optional link to where the subgraph lives.
Graft Base
An optional base to graft onto. See Graft Base for details.
Array<Data Source Spec>
required
Each data source spec defines the data that will be ingested as well as the transformation logic to derive the state of the subgraph’s entities based on the source data.See Data Sources for complete documentation.
Array<Data Source Template Spec>
Each data source template defines a data source that can be created dynamically from the mappings.See Data Source Templates for complete documentation.
Array<String>
A list of feature names used by the subgraph. Required for specVersion >= 0.0.4.See Features for available feature names.

Schema

The schema defines the GraphQL types that will be generated for your subgraph.
Path
required
The path of the GraphQL IDL file, either local or on IPFS.See Path for format details.

Example

Path

A path has one field path, which either refers to a path of a file on the local dev machine or an IPLD link. When using the Graph-CLI, local paths may be used during development, and then, the tool will take care of deploying linked files to IPFS and replacing the local paths with IPLD links at deploy time.
String | IPLD Link
required
A path to a local file or IPLD link.

Graft Base

A subgraph can be grafted on top of another subgraph, meaning that, rather than starting to index the subgraph from the genesis block, the subgraph is initialized with a copy of the given base subgraph, and indexing resumes from the given block.
Grafting requires the grafting feature to be declared in the features list for specVersion >= 0.0.4.
String
required
The subgraph ID of the base subgraph.This is the IPFS hash of the deployed subgraph.
BigInt
required
The block number up to which to use data from the base subgraph.Indexing will resume from this block number.

Example

Features

Starting from specVersion 0.0.4, a subgraph must declare all feature names it uses to be considered valid.
A Graph Node instance will reject a subgraph deployment if:
  • the specVersion is equal to or higher than 0.0.4 AND
  • it hasn’t explicitly declared a feature it uses.
No validation errors will happen if a feature is declared but not used.

Available Features

Feature
Enables non-fatal error handling in mappings. When enabled, errors in handlers won’t stop the subgraph from syncing.
Enables full-text search capabilities on entities. Requires special field annotations in the schema.
Feature
Enables grafting functionality. Required when using the graft field in the manifest.
Feature
Enables IPFS data fetching from Ethereum contract events and calls.

Example

Complete Manifest Example

Next Steps

Data Sources

Learn about configuring data sources

Mappings

Configure handlers and mapping logic