The processor service is a background node.js process responsible for data ingestion, transformation and data persisting into the target database. By convention, the processor code is located in
src/processor.ts. It is run as
For local runs, one normally additionally exports environment variables from
node -r dotenv/config lib/processor.js
The Squid SDK currently offers specialized processor classes for EVM (
EvmBatchProcessor) and Substrate networks (
SubstrateBatchProcessor). More networks will be supported in the future.
Navigate to a dedicated section for each processor class:
A processor instance should be configured to define the block range to be indexed, and the selectors of data to be fetched from the archive. See the configuration pages of the corresponding sections.
The actual data indexing is done by the
run() method called on a processor instance. The method has the following signature:
run<Store>(db: Database<Store>, batchHander: (ctx: BatchContext<Store, Item>) => Promise<void>): void
db argument defines the target data source for the processor, and
batchHandler is an
void function defining the data transformation and persistence logic.
Store interfaces are explained in the next sections.
To jump straight to examples, see EVM Processor in action and Substrate Processor in action.