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
  • Install binaries
  • Download merged blocks locally
  • Run the Substreams engine locally
  • Stream against your local instance

Was this helpful?

Edit on GitHub
  1. Reference Material
  2. Indexer Reference

Test Substreams Locally

PreviousIndexer ReferenceNextLogging, Debugging & Testing

Last updated 9 months ago

Was this helpful?

You can run a Substreams server locally to run e2e testing.

It requires a local copy of full merged-blocks files for the range you want to test over. You can easily download those files from a Firehose endpoint.

Then run the Substreams software locally, and run tests against it

Install binaries

Install the firehose-core single binary for most chains (those without chain-specific extensions) with brew:

brew install streamingfast/tap/firehose-core

or get a release from:

Install the firehose-ethereum single binary with brew:

brew install streamingfast/tap/firehose-ethereum

or get a release from:

Download merged blocks locally

Run against an endpoint for the chain you're interested in. For example:

fireeth tools download-from-firehose mainnet.eth.streamingfast.io:443 1000 2000 \
   ./firehose-data/storage/merged-blocks

which will download merged blocks to your local disk. You might need to be authenticated.

Run the Substreams engine locally

Run:

fireeth start substreams-tier1,substreams-tier2 --config-file= \
  --common-live-blocks-addr= --common-first-streamable-block=1000 \
  --substreams-state-bundle-size=10

Notes:

  1. the --common-first-streamable-block must be the lowest block available on disk, otherwise the server will fail to start.

  2. if you need to do eth_calls with the Ethereum, you can add: --substreams-rpc-endpoints https://example.com/json-rpc/somekeysometimes

  3. the --substreams-state-bundle-size=10 flag will write smaller stores snapshot, suitable for dev

This will run a fully workable stack

Stream against your local instance

Test with:

substreams run -e localhost:10016 --plaintext \
  https://spkg.io/streamingfast/ethereum-explorer-v0.1.2.spkg \
  map_block_meta -s 1000 -t +10

and enjoy.

https://github.com/streamingfast/firehose-core/releases
https://github.com/streamingfast/firehose-ethereum/releases