Skip to main content
Version: FireSquid

EVM Processor

warning

The EVM Archive API and EvmBatchProcessor are currently in beta. Breaking changes may be introduced in the future releases of the Squid SDK.

This section applies to squids indexing EVM chains. Subsquid supports all major EVM chains, including Ethereum, Polygon, BSC and many others. See the configuration page for a full list.

Overview and the data model

A squid processor is a Node.js process that fetches historical on-chain data from an Archive, performs arbitrary transformations and saves the result. By convention, the processor entry point is src/processor.ts. EvmBatchProcessor is the central class that handles EVM data extraction, transformation and persistence. A single batch handler function supplied to EvmBatchProcessor.run() is responsible for transforming data from multiple events and transactions in a single in-memory batch.

A batch can be thought of a simplified execution trace of the EVM runtime. It consists of evmLog and transaction items. The list of items that get into the batch is determined by the filters defined by the EvmBatchProcessor configuration. Configuration is set by calling the addLog() and addTransaction() methods. The items in the batch are canonically ordered. Any event log item placed in a batch will always be immediately followed by an item for the transaction that emitted the event.

Further, the processor can extract additional data by querying the historical chain state and indeed any external API.

Results of the ETL process can be stored in any Postgres-compatible database. Support for storing to CSV and Parquet, located either on a local filesystem or on an Amazon S3-compatible cloud storage, is currently experimental.

A typical processor looks as below:

Batch processor context

What's next?