Skip to main content
Use this guide when you want to index Berachain blockchain data (e.g. ERC20 balances) and query it via GraphQL using the Goldsky subgraph SDK.

Repository

Official documentation

Requirements

  • Node v20.11.0 or greater, npm
  • Goldsky account and API key
  • Goldsky CLI (install: curl https://goldsky.com | sh)

Stack

Node.js, Goldsky CLI, GraphQL subgraph (schema + mappings).

Quick start

  1. Clone and install
    git clone https://github.com/berachain/guides.git && cd guides/apps/goldsky-subgraph
    npm install
    
  2. Goldsky setup: Create account at app.goldsky.com, create API key, install CLI, run goldsky login.
  3. Build subgraph
    npm run codegen
    npm run build
    
  4. Deploy
    goldsky subgraph deploy erc20-subgraph/1.0.0 --path .
    
  5. Query — After indexing, use the public GraphQL endpoint (see Goldsky dashboard). Example query for accounts and balances in README.

Key files

PurposePath
Subgraph config / schemaProject root (see README)
MappingsSee README