Overview
Classic Stellar payment operations to airdrop recipient addresses need to be tracked via Horizon's event streaming API. This enables confirming recipient payouts and detecting trust-line establishment in real time.
What to Stream
- Payment operations to tracked recipient addresses
- Trust line changes — detect when recipients establish the required trust line before claiming
- Account created — detect when a new account is funded by an airdrop operation
Architecture
Horizon SSE (/accounts/:id/operations)
│
▼
StreamManager (reconnects on disconnect, tracks cursor)
│
▼
PaymentProcessor (validates, deduplicates, stores)
│
▼
DB (payment_operations table) + Webhook dispatcher
Implementation
// src/indexer/horizonStream.js
const { Horizon } = require('@stellar/stellar-sdk');
class HorizonStreamManager {
constructor(server, accounts) { ... }
start() { /* opens SSE stream per tracked account */ }
stop() { /* closes all streams */ }
onPayment(handler) { ... }
}
- Use
stellar-sdk's server.operations().forAccount(id).stream()
- Persist last paging token per account to DB
- Resume from stored cursor on service restart
- Reconnect with exponential backoff (1s → 5s → 30s)
Acceptance Criteria
Overview
Classic Stellar payment operations to airdrop recipient addresses need to be tracked via Horizon's event streaming API. This enables confirming recipient payouts and detecting trust-line establishment in real time.
What to Stream
Architecture
Implementation
stellar-sdk'sserver.operations().forAccount(id).stream()Acceptance Criteria
HorizonStreamManagerimplemented/api/v1/indexer/status