Skip to main content
The Source component connects to SQD Portal and streams blockchain data to your pipeline. It’s the starting point for all Pipes SDK data flows.

evmPortalSource

Create a Portal source for EVM chains.
evmPortalSource(config: EvmPortalSourceConfig): Source
Parameters:
  • portal: Portal API URL or config object
    • String: "https://portal.sqd.dev/datasets/ethereum-mainnet"
    • Object: { url: string, finalized?: boolean }
  • query: EvmQueryBuilder instance (optional)
  • cursor: Resume from block { number: number } (optional)
  • cache: Portal cache instance (optional)
  • logger: Logger instance or false/'silent' to disable logging (optional)
  • metrics: MetricsServer for monitoring (optional)
  • progress: ProgressTrackerOptions for progress tracking (optional)
Example:
import { evmPortalSource } from "@subsquid/pipes/evm";
import { portalSqliteCache } from "@subsquid/pipes/portal-cache/node";

const source = evmPortalSource({
  portal: "https://portal.sqd.dev/datasets/ethereum-mainnet",
  query: queryBuilder,
  cursor: { number: 20000000 },
  cache: portalSqliteCache({ path: "./cache.sqlite" }),
});
Use portalSqliteCache during development to avoid re-fetching data from Portal on every restart. For production, caching is usually unnecessary.

Finalized Blocks

You can configure the source to only receive finalized blocks:
const source = evmPortalSource({
  portal: {
    finalized: true,
    url: 'https://portal.sqd.dev/datasets/ethereum-mainnet'
  }
});
Using finalized blocks eliminates the need for rollback handlers in your targets, simplifying your pipeline logic.
Set logger: false or logger: 'silent' to disable logging in the Portal source. Useful when integrating into applications with custom logging.

Pipe Methods

Methods for chaining transformers and connecting to targets.

pipe

Chain a single transformer to the source.
source.pipe(transformer)

pipeComposite

Chain multiple transformers that run in parallel.
source.pipeComposite({
  key1: transformer1,
  key2: transformer2
})

pipeTo

Connect the pipeline to a target (terminal operation).
source.pipeTo(target)
pipeTo is a terminal operation. You cannot continue piping after calling this method.