Skip to content

Indexer

The Indexer is a real-time blockchain event monitoring service that indexes and stores ZeroLedger protocol events in a searchable database. It is implemented as a core module within the Trusted Encryption Service (TES) backend.

Architecture

Real-Time Event Monitoring

The Indexer continuously monitors blockchain events using:

  • WebSocket RPC Connection: Maintains persistent connection for real-time event streaming
  • Contract Monitoring: Tracks events from Vault and Forwarder contracts
  • Block Range Processing: Can index historical events from a configurable START_BLOCK
  • Event Parsing: Extracts and processes transaction calldata for additional metadata

Event Processing Model

The Indexer uses a queue-based processing pattern:

  • Short-Lived Records: Saves incoming events to temporary database records
  • Pull-Based Consumption: Subscribers (Paymaster, Sync Service) actively pull events from the queue
  • Event Processing: Subscribers process events and then remove them from the queue
  • Decoupled Architecture: Indexer and subscribers operate independently

Integration with TES

The Indexer is a foundational module within TES that powers multiple services:

Sync Service

  • Provides fast commitment synchronization for Web App
  • Returns user's complete transaction history efficiently
  • Enables quick balance calculations

Paymaster Service

  • Monitors invoice proxy addresses for incoming payments
  • Triggers automatic invoice execution when sufficient tokens detected
  • Tracks user activity for gas sponsorship decisions