Skip to content

subsquid/firehose-grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firehose-grpc

A Firehose gRPC server, written in Rust, that serves Ethereum block data to The Graph's graph-node using SQD Portal as the data source instead of a geth node.

What it is

graph-node can consume blockchain data through the StreamingFast Firehose gRPC interface. firehose-grpc implements that interface (the sf.firehose.v2 Stream and Fetch services) and answers requests by reading from a SQD Portal endpoint rather than from a running Ethereum node. The server requests blocks, logs, transactions, and traces from the Portal and maps them into the Ethereum Firehose block format (sf.ethereum.type.v2) that graph-node expects.

SQD Portal is the data API of SQD Network, an open data platform for Web3. See the SQD documentation for more on the Portal and the network.

How it works

  • Exposes the Firehose v2 gRPC services on 0.0.0.0:13042:
    • Stream.Blocks: streams blocks from a starting block (with cursor and stop-block support).
    • Fetch.Block: returns a single block by number, hash, or cursor.
  • gRPC server reflection is enabled.
  • Reads block data from a SQD Portal endpoint over HTTP.
  • Optionally uses an Ethereum JSON-RPC node as a source for recent ("hot") blocks near the chain head. When configured, it also tracks chain reorganizations and emits STEP_UNDO / STEP_FINAL steps accordingly.
  • Serves Prometheus metrics on 0.0.0.0:3000/metrics.

Build

Requires a Rust toolchain and the Protocol Buffers compiler (protoc).

cargo build --release

The binary is produced at target/release/firehose-grpc.

Docker

docker build -t firehose-grpc .

The image entrypoint is the firehose-grpc binary and exposes port 13042.

Usage

firehose-grpc --portal <PORTAL_URL> [--rpc <ETH_RPC_URL> --finality-confirmation <N>]

Arguments:

Flag Required Description
--portal yes SQD Portal endpoint URL used as the data source.
--rpc no Ethereum JSON-RPC URL used as a source for recent blocks near the head.
--finality-confirmation with --rpc Number of blocks after which a block is considered final. Required when --rpc is set.

The gRPC server listens on port 13042 and Prometheus metrics are served on port 3000.

Documentation

About

Drop-in firehose-ethereum gRPC server (Rust) that feeds graph-node from SQD Portal instead of a geth node.

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors