Building Subgraphs on The Graph: A Developer Tutorial

Added:

Intro & Prizes
Subgraph Basics
Setup & Deploy
Writing Mappings
Data Templates
Debugging Locally
Complex Examples
IPFS & FAQs

Intro & Prizes

0:13
Playing Section
  • 1

    The Graph is an indexing protocol for Ethereum and IPFS data.

  • 2

    Prizes include $1000 for best subgraph use or new subgraph.

  • 3

    Existing subgraphs offer rich data via API endpoints.

Basic understanding of Ethereum, smart contracts, and how decentralized applications (dApps) execute transactions.
Familiarity with GraphQL query syntax, schemas, and basic data types.
Proficiency with development tools such as Node.js, npm/yarn, and interacting with Command Line Interfaces (CLI).
Fundamental concepts of data indexing and why standard blockchain RPC nodes are inefficient for complex querying.
Integrating queried subgraph data into frontend applications using client libraries like Apollo Client or Urql.
Writing robust unit and integration tests for subgraphs using the Matchstick testing framework.
Deploying subgraphs to the decentralized Graph Network and managing curation, indexer fees, and GRT staking.
Implementing advanced subgraph features such as multi-chain indexing, handling blockchain reorgs, and schema optimizations for high-throughput dApps.
12.3K views215likes59:19@ETHGlobalOriginal Release: 2020-10-06

A subgraph on The Graph is a data indexing and querying system built on top of Ethereum that allows developers to create GraphQL APIs for blockchain data by combining three core components: a manifest file (YAML) that defines data sources and event handlers, a GraphQL schema that defines how data should be stored and queried, and mapping functions (written in AssemblyScript) that process on-chain events and save data to the database; developers can deploy subgraphs to The Graph's hosted service using the Graph CLI, which handles the underlying infrastructure, and can leverage existing community-built subgraphs like Uniswap or create their own custom subgraphs for various use cases.