2 minutes
Introduction to Substreams

To start coding right away, check out the Substreams Quick Start.
Översikt
Substreams is a powerful parallel blockchain indexing technology designed to enhance performance and scalability within The Graph Network.
Substreams Benefits
- Accelerated Indexing: Boost subgraph indexing time with a parallelized engine for quicker data retrieval and processing.
- Multi-Chain Support: Expand indexing capabilities beyond EVM-based chains, supporting ecosystems like Solana, Injective, Starknet, and Vara.
- Enhanced Data Model: Access comprehensive data, including the
trace
level data on EVM or account changes on Solana, while efficiently managing forks/disconnections. - Multi-Sink Support: For Subgraph, Postgres database, Clickhouse, and Mongo database.
How Substreams Works in 4 Steps
- 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), })}
-
You wrap up your Rust program into a WASM module just by running a single CLI command.
-
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.
-
You select a sink, a place where you want to send the transformed data (such as a SQL database or a Subgraph).
Ytterligare resurser
All Substreams developer documentation is maintained by the StreamingFast core development team on the Substreams registry.