Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

Subgraph

1 min read
Pronunciation
[suhb-graf]
Analogy
Like creating a custom view in a database that selects and transforms tables into a tailored report.
Definition
A specification in The Graph protocol defining how to index and query blockchain data, including a GraphQL schema, data sources, and mapping logic.
Key Points Intro
Subgraphs enable efficient, customizable indexing and querying of blockchain events.
Key Points

Manifest: defines data sources, ABIs, and events to index

Mapping: AssemblyScript functions transform events into entities

Schema: GraphQL definitions for queryable entity types

Deployment: published to The Graph network for indexing

Example
The Uniswap v3 subgraph indexes Swap, Mint, and Burn events to provide real-time liquidity and volume data via GraphQL queries.
Technical Deep Dive
Subgraph manifests (YAML) list Ethereum contracts and ABIs; mapping handlers decode event parameters and call `store.set()` methods. IPFS hosts subgraph metadata. Graph Node runs indexing, stores entities in a relational store, and serves GraphQL endpoints with resolvers generated from schema.
Security Warning
Malformed or malicious mappings can crash indexing nodes; review AssemblyScript code carefully.
Caveat
Indexing large contracts with high event volumes may incur significant query latency and fees.

Subgraph - Related Articles

No related articles for this term.