Firehose Acme

StreamingFast Firehose template sample for A Company that Makes Everything

Instrumenting a new chain from scratch requires the node native code to be instrumented to output Firehose logs, but this is only one side of the coin. A Firehose instrumentation of a new chain requires also a firehose-<chain> program that contains chain-specific code to read the data output by the instrumented node, and serves data throughout the Firehose stack.

This firehose-<chain> is a Golang project that contains the CLI, the reader code necessary to assemble Firehose node output into chain-specific Blocks, and a bunch of other small boilerplate code around the Firehose set of libraries.

To ease the work of Firehose implementors, we provide a "template" project firehose-acme that is the main starting point for instrumenting new, unsupported blockchain nodes.

It consists of basic code and a Dummy Blockchain prototype. The idea is that you can play with this firehose-acme instance to see blocks produced and test some Firehose behaviors.

Install firehose-acme

Clone the repository:

git clone git@github.com:streamingfast/firehose-acme

Install the fireacme binary:

cd firehose-acme
go install ./cmd/fireacme

A Go installation is required for the command below to work and the path where Golang install binaries should be available in your PATH (can be added with export PATH=$PATH:$(go env GOPATH)/bin, see GOPATH for further details).

And validate that everything is working as expected:

fireacme --version
fireacme version dev (Built 2023-02-02T13:42:20-05:00)

If fireacme is not found, please check https://go.dev/doc/gopath_code#GOPATH

Install the dummy blockchain

Obtain the Dummy Blockchain by installing from source:

And validate that it was installed correctly:

Run it

A simple shell script that starts firehose-acme with sane default is located at devel/standard/start.sh. The configuration file used to launch all the applications at once is located at devel/standard/standard.yaml

Run the script from your local cloned firehose-acme version as done in firehose-acme installation section:

The following messages will be printed to the terminal window if:

  • All of the configuration changes were made correctly,

  • All system paths have been set correctly,

  • And the Dummy Blockchain was installed and set up correctly.

To integrate the target blockchain modify devel/standard/standard.yaml and change the start.flags.mindreader-node-path flag to point to the custom integration's blockchain node binary.

Define protobuf types

Update the proto file sf/acme/type/v1/type.proto to model your chain's data model.

Generate structs

After updating the references to "Acme" the Protocol Buffers need to be regenerated. Use the generate shell script to make the updates.

Implement the reader

The console_reader.go file is the interface between the instrumented node's output and the Firehose ingestion process.

Each blockchain has specific pieces of data, and implementation details that are paticular to that blockchain. Reach out to us if you need guidance here.

Run tests

After completing all of the previous steps the base integration is ready for initial testing.

If all changes were made correctly the updated project should compile successfully.

Wrap up the integration

You can reach out to the StreamingFast team on Discord. We usually maintain these Go-side integrations and keep them up-to-date. We can review, and do the renames as needed.

Rename

You can also rename the project and all files and references to acme to your own chain's name. Choose two names, a long-form and a short form for the custom integration following the naming conventions outlined below.

For example:

  • arweave and arw

Then finalize the rename:

  • Rename cmd/fireacme -> cmd/firearw (short form)

  • Search and replace fireacme => firearw (short form)

  • Conduct a global search and replace from: acme => arweave (long form)

  • Conduct a global search to replace ACME => ARWEAVE (long form)

  • Conduct a global search to replace Acme => Arweave (long form)

Last updated