SettleMint
ArchitectureComponentsInfrastructure

Chain Indexer

The Chain Indexer transforms blockchain-optimized event logs and storage into domain model data structures optimized for application queries, providing millisecond-latency access to historical blockchain state.

Overview

The Chain Indexer bridges the gap between blockchain data structures and application requirements. Blockchain storage optimizes for consensus verification, not application queries. The indexer transforms event logs into domain models that serve application needs efficiently.

Application queries demand millisecond response times. Blockchain node queries for historical data can take seconds or fail entirely for complex aggregations. The Chain Indexer maintains query-optimized representations of blockchain state for responsive application experiences.

Data translation

Rendering diagram...

Event processing

Event subscription

The indexer subscribes to contract events through the Chain Gateway. New block notifications trigger event retrieval for monitored contracts. Historical sync processes missed blocks during indexer downtime.

Handler execution

Event handlers receive decoded event parameters. Handlers execute business logic to update domain models. Handler execution is deterministic—the same events always produce the same state.

State computation

Some domain models require computed state from multiple events. Transfer events update balance aggregates. Compliance events affect investor verification status. The indexer maintains these computed values for efficient queries.

Domain models

The indexer constructs domain models optimized for application use cases:

Domain modelSource eventsQuery patterns
Asset balancesTransfer, Mint, BurnBalance by holder, asset totals
Investor portfoliosTransfer, VerificationHoldings by investor, portfolio value
Transaction historyAll eventsFiltered by asset, investor, time
Compliance statusVerification eventsCurrent status, history
Distribution recordsDistribution eventsPending, completed, by period

Consistency handling

Block confirmation

Events from recent blocks may revert due to chain reorganizations. The indexer tracks confirmation depth and marks recent data as provisional. Applications display confirmation status for recent transactions.

Reorg recovery

Chain reorganizations require state rollback and reprocessing. The indexer maintains rollback capability for configurable block depths. Detected reorgs trigger:

  1. Identification of affected blocks
  2. State rollback to fork point
  3. Reprocessing of canonical chain
  4. Notification to connected clients

Idempotent processing

Event processing is idempotent. Reprocessing the same events produces identical state. This property enables safe recovery from any failure scenario.

Query performance

Indexed access

Database schemas optimize for expected query patterns. Indexes cover common filter and sort operations. Query analysis guides index maintenance.

Materialized aggregates

Frequently accessed aggregates materialize in dedicated tables. Balance totals, transaction counts, and status summaries update incrementally rather than computing on demand.

Pagination support

Large result sets paginate efficiently through cursor-based navigation. Consistent ordering guarantees stable pagination across concurrent updates.

Real-time updates

Connected clients receive real-time state updates through WebSocket connections. Event processing triggers notifications to subscribed clients. Update latency from block confirmation to client notification measures in milliseconds.

Monitoring

Indexer health exposes through multiple metrics:

MetricPurposeAlert threshold
Block lagProcessing currencyBlocks behind > 10
Processing timeHandler performanceP99 > 100ms
Error rateHandler failuresRate > 0.1%
Reorg depthChain stabilityDepth > 3 blocks

Blockchain indexer monitoring all on-chain transactions

See also

On this page