Reading time: 2 min

Substreams Logo

Substreams is a powerful blockchain indexing technology, developed for The Graph Network. Substreams enables developers to write Rust modules, composing data streams alongside the community, and provides extremely high-performance indexing by virtue of parallelization, in a streaming-first fashion.

With Substreams, you can extract data from different blockchains (Ethereum, BNB, Solana...) ultra-fast! Then, you can send to data to several locations (a Postgres database, a Mongo database, or a Subgraph).

How Substreams Works in 4 Steps

Ссылка на этот раздел
  1. You write a Rust program, which defines the transformations that you want to apply to the blockchain data. For example, the following Rust function extracts relevant information from an Ethereum block (number, hash, and parent hash).
fn get_my_block(blk: Block) -> Result<MyBlock, substreams::errors::Error> {
let header = blk.header.as_ref().unwrap();
Ok(MyBlock {
number: blk.number,
hash: Hex::encode(&blk.hash),
parent_hash: Hex::encode(&header.parent_hash),
  1. You wrap up your Rust program into a WASM module just by running a single CLI command.

  2. The WASM container is sent to a Substreams endpoint for execution. The Substreams provider feeds the WASM container with the blockchain data and the transformations are applied.

  3. You select a sink, a place where you want to send the transformed data (a Postgres database or a Subgraph, for example).

Substreams Documentation

Ссылка на этот раздел

The official Substreams documentation is currently maintained by the StreamingFast team on the StreamingFast website.

Начало работы

Ссылка на этот раздел
  • In order to develop and deploy a Substreams, you must install the Substreams CLI.
  • Then, run your first Substreams by following the Quickstart Tutorial.
Редактировать страницу

Руководство по переходу на валидацию GraphQL
Эксплуатация Graph Node
Редактировать страницу