LogoLogo
Package RegistryThe Graph
  • Introduction
  • Getting Started
  • Tutorials
    • Develop Your First Substreams
      • on EVM
      • on Solana
        • Transactions & Instructions
        • Account Changes
      • on Cosmos
        • Injective
        • MANTRA
      • on Starknet
      • on Stellar
    • Publishing a Substreams Package
  • How-To Guides
    • Developing Substreams
      • on EVM
        • Exploring Ethereum
          • Mapping Blocks
          • Filter Transactions
          • Retrieve Events of a Smart Contract
      • on Solana
        • Explore Solana
          • Filter Instructions
          • Filter Transactions
        • SPL Token Tracker
        • NFT Trades
        • DEX Trades
      • on Cosmos
        • Injective
          • Simple Substreams Example
          • Foundational Modules
          • Dojo DEX USDT Volume Subgraph Example
    • Using a Substreams Sink
      • Substreams:SQL
      • Substreams:Subgraph
        • Triggers
        • Graph Out
      • Substreams:Stream
        • JavaScript
        • Go
      • Substreams:PubSub
      • Community Sinks
        • MongoDB
        • Files
        • Key-Value Store
        • Prometheus
    • EVM Extensions
      • Making eth_calls
    • Getting Started Using Rust and Protobuf
      • Rust
        • Option struct
        • Result struct
      • Protobuf Schemas
    • From Yellowstone to Substreams
  • Reference Material
    • Chains and endpoints
      • Ethereum Data Model
    • Never Miss Data
    • Development Container Reference
    • Substreams CLI
      • Install the CLI
      • Authentication
      • Substreams CLI reference
    • Substreams Components
      • Packages
      • Modules
        • Module types
        • Inputs
        • Output
        • Module handlers
        • Module handler creation
        • Indexes
        • Keys in stores
        • Dynamic data sources
        • Aggregation Windows
        • Parameterized Modules
      • Manifests Reference
    • Substreams Architecture
    • Graph-Node
      • Local Development
      • Publish to The Graph Network
    • Indexer Reference
      • Test Substreams Locally
    • Logging, Debugging & Testing
    • Change log
    • FAQ
  • Decentralized Indexing
    • What is The Graph?
Powered by GitBook
On this page
  • Requirements
  • Set up the Environment
  • Interact With the Graph Node

Was this helpful?

Edit on GitHub
  1. Reference Material
  2. Graph-Node

Local Development

PreviousGraph-NodeNextPublish to The Graph Network

Last updated 5 months ago

Was this helpful?

The Graph Node is the software that indexers run to index subgraphs. When developing a subgraph (or Substreams-powered subgraph), it is very convenient to test the subgraph deployment locally. This can be achieved by running the Graph Node software and all its dependencies in a local Docker environment.

Clone the , which contains the necessary shell scripts to run a local Graph Node in your computer.

Requirements

This tutorial requires you to:

  • Have Docker installed.

  • Run a Unix-like operating system, so that you can execute bash scripts.

Set up the Environment

In the , move to the graph-node folder. The entrypoint to set up the Graph Node local environment is the start.sh script, which spins up a Graph Node instance configured for a specific network (e.g. injective-mainnet), along with a local IPFS node and a local Postgres database. When using this script, you must pass two parameters: NETWORK and SUBSTREAMS_ENDPOINT.

./start.sh <NETWORK> <SUBSTREAMS_ENDPOINT>

For example, the following command spins up a Graph Node for the injective-mainnet network using the https://mainnet.injective.streamingfast.io:443 Substreams endpoint.

./start.sh injective-mainnet https://mainnet.injective.streamingfast.io:443

The script also expects the environment variable to be configured with your Substreams API authentication token.

Interact With the Graph Node

You can interact with the Graph Node using the Graph CLI (graph). Some useful command are:

  • graph build --ipfs=http://localhost:5001: build the subgraph and store the build files in the local IPFS node.

  • graph create <NAME> --node=http://localhost:8020: create a new subgraph in the local Graph Node.

  • graph remove <NAME> --node=http://localhost:8020: remove an existing subgraph in the local Graph Node.

  • graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 <NAME>: deploy a subgraph to the local Graph Node.

Substreams Development Environment GitHub repository
Substreams Development Environment GitHub repository
SUBSTREAMS_API_TOKEN