Test Substreams Locally
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:
or get a release from: https://github.com/streamingfast/firehose-core/releases
Download merged blocks locally
Run against an endpoint for the chain you're interested in. For example:
which will download merged blocks to your local disk. You might need to be authenticated.
Run the Substreams engine locally
Run:
Notes:
the
--common-first-streamable-block
must be the lowest block available on disk, otherwise the server will fail to start.if you need to do
eth_calls
with the Ethereum, you can add:--substreams-rpc-endpoints https://example.com/json-rpc/somekeysometimes
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:
and enjoy.
Last updated