githubEdit

Legacy Firehose Indexing

Legacy Firehose indexing and transforms (deprecated)

circle-exclamation

Overview

Firehose can generate block indexes that optimally serve requests containing filtering parameters. This feature was designed primarily for graph-node integration and is not recommended for general use.

How Indexes Work

Firehose indexes function in two primary ways:

  1. Block skipping: Block files aren't read for ranges within block indexes that do not match the filter provided.

  2. Payload reduction: Block files containing both matching and non-matching transactions return a reduced payload of only matched transactions.

Enabling Indexes

circle-info

Blockchains have varying levels of support for indexes. For example, firehose-ethereum has support while many other chains do not.

Index Configuration Flags

Use the following flag for valid index bundle sizes when looking for block indexes:

--common-index-block-sizes [ints]

Default values: 100000,10000,1000,100

Common store URL to read and write index files:

Default: file://{sf-data-dir}/storage/index

Index Builder

The Firehose Index Builder generates index files from merged blocks. It can be run:

  • Sequentially: To produce indexes as merged-blocks are produced

  • In parallel: Multiple instances over different block ranges to quickly process millions of blocks

Running the Index Builder

Transforms

Transforms are Protocol Buffer definitions used to locate specific blocks according to search criteria. They are used by graph-node to filter blockchain data before indexing.

Ethereum Transforms

For Ethereum, transforms support filtering by:

  • Log filters: Match transactions containing logs with specific addresses and topics

  • Call filters: Match transactions containing calls to specific addresses

Example: Log Filter

Match transactions with logs from a specific address and topic:

Example: Call Filter

Match transactions containing calls to specific addresses:

Transform Protocol Buffers

Transforms are defined in the chain-specific protobuf definitions. For Ethereum, see the CombinedFilter in:

sf/ethereum/transform/v1/transforms.protoarrow-up-right

graph-node Integration

The primary use case for indexing and transforms is graph-node integration. When running graph-node with Firehose:

  1. graph-node sends transform filters based on subgraph manifest requirements

  2. Firehose uses indexes to skip irrelevant block ranges

  3. Only matching data is returned to graph-node for indexing

For graph-node setup with Firehose, refer to The Graph documentationarrow-up-right.

Migration to Substreams

For new data filtering and transformation needs, use Substreams instead:

  • Better performance: Parallel processing with caching

  • More flexibility: Custom Rust/WASM logic

  • Ecosystem support: Multiple output sinks available

See the Substreams documentationarrow-up-right for details.

Last updated

Was this helpful?