Context
Applications need real-time visibility into on-chain events (payments, disputes, settlements) without polling RPC endpoints. AgenticPay lacks a dedicated event indexer with streaming capabilities.
Current Limitation/Problem
Frontend and SDK clients poll the backend for transaction status, creating unnecessary load. There is no unified event stream for contract state changes across Stellar and EVM.
Expected Outcome
A horizontally scalable event indexer that ingests contract events from both Stellar Soroban and EVM chains, normalizes them into a common schema, and pushes them to subscribed clients via WebSocket with automatic reconnection.
Acceptance Criteria
- Index all relevant events (PaymentSent, PaymentReceived, DisputeRaised, SettlementCompleted, etc.) from Stellar Soroban and EVM
- Push events to authenticated WebSocket clients within 2 seconds of on-chain confirmation
- Support event filtering by contract address, event type, and time range
- Handle chain reorganizations (at least 6 confirmations deep)
- Expose REST API for historical event replay
- Auto-prune events older than configurable retention period
- Maintain at-least-once delivery semantics with deduplication
Technical Scope
backend/src/services/indexer/ - new indexer service
backend/src/services/indexer/soroban-listener.ts - Stellar event polling
backend/src/services/indexer/evm-listener.ts - EVM event polling (ethers.js)
backend/src/websocket/event-stream.ts - WebSocket handler with Socket.IO or ws
- Prisma schema:
IndexedEvent, WebSocketSubscription models
- Redis pub/sub for cross-instance event broadcasting
- BullMQ queue for event persistence and deduplication
- Edge cases: RPC rate limits, connection drops, missed blocks, reorgs
Context
Applications need real-time visibility into on-chain events (payments, disputes, settlements) without polling RPC endpoints. AgenticPay lacks a dedicated event indexer with streaming capabilities.
Current Limitation/Problem
Frontend and SDK clients poll the backend for transaction status, creating unnecessary load. There is no unified event stream for contract state changes across Stellar and EVM.
Expected Outcome
A horizontally scalable event indexer that ingests contract events from both Stellar Soroban and EVM chains, normalizes them into a common schema, and pushes them to subscribed clients via WebSocket with automatic reconnection.
Acceptance Criteria
Technical Scope
backend/src/services/indexer/- new indexer servicebackend/src/services/indexer/soroban-listener.ts- Stellar event pollingbackend/src/services/indexer/evm-listener.ts- EVM event polling (ethers.js)backend/src/websocket/event-stream.ts- WebSocket handler with Socket.IO or wsIndexedEvent,WebSocketSubscriptionmodels