Indexing unfinalized blocks
Starting with the ArrowSquid release, Subsquid SDK supports indexing blocks before they are finalized, enabling real-time use cases. To take advantage of this feature, a squid processor must
- have a node RPC endpoint as one of its data sources and
- use a
Databasewith hot blocks support (e.g.
TypeormDatabase) in its
- (EVM only) not set the
With this, the processor will consider some blocks to be "hot":
EvmBatchProcessor: all blocks with fewer confirmations than the number set by the
SubstrateBatchProcessor: all blocks above the latest finalized block provided by the
The processor will periodically (interval setting for EVM, Substrate) poll the RPC endpoint for changes in consensus. When the consensus changes, it will re-run the batch handler with the new consensus data and ask the
Database to adjust its state. The
Database then must roll back the changes made due to orphaned blocks and apply the new changes. With this, the state of the
Database reflects the current blockchain consensus at all times.