Firehose on StarkNet

Firehose implementation for StarkNet, bootstrapped from streamingfast/firehose-acme. This project is maintained by the zkLend team.

Running for development

Note that these instructions are only suitable for development purposes. For production workload, you’d probably want to run a high-availability setup.

To run a Firehose-enabled pathfinder node, you need to install the instrumented fork version we also maintain:

$ cargo install --locked --git https://github.com/starknet-graph/pathfinder --branch patch

Alternatively, you can also build the binary without installing. Just make sure to modify standard.yaml to point to the resulting binary.

Then, replace ETHEREUM_URL in standard.yaml with a valid Ethereum JSON-RPC URL for the L1 network you’re going to sync.

After which you can just run:

$ cd ./devel/standard
$ mkdir -p ./pathfinder-data
$ ./start.sh

The instrumented pathfinder node should now start syncing. You can test the setup by subscribing to the block stream with grpcurl:

$ grpcurl -plaintext -d '{"start_block_num": 5}' localhost:18015 sf.firehose.v2.Stream.Blocks

Generating protobuf types

A script is available for generating Go types from protobuf files. Unless you have a specific reason to use another version, make sure you have the exact versions of the following tools installed:

$ protoc --version
libprotoc 3.19.4
$ protoc-gen-go --version
protoc-gen-go v1.27.1

You will also need to have streamingfast/proto cloned in the same folder where the current repository lives.

Then, invoke the script to generate the types:

$ ./types/pb/generate.sh

If any diff is found, make sure to also commit the last_generate.txt file so that others know what exact code versions were used to generate the types. If you’re making changes to the proto files, make sure to commit those proto changes first before running the script, otherwise checking out to the revision specified in last_generate.txt would yield the proto files before the changes.

License

Apache 2.0

GitHub

View Github