A real-time Solana blockchain transaction indexer built in Rust. It connects to Solana mainnet via WebSocket, parses and stores transactions in PostgreSQL, and serves a REST API, WebSocket feed, and Prometheus metrics endpoint.
Solana mainnet (WebSocket)
|
v
Ingestion layer <- logsSubscribe, auto-reconnect with exponential backoff
| tokio::mpsc
v
Parser <- extracts signature, slot, programs, token transfers
|
+--> PostgreSQL <- batch inserts, ON CONFLICT DO NOTHING
|
+--> broadcast::channel -> WebSocket clients (live feed)
axum HTTP server <- REST API + WebSocket endpoint + Prometheus metrics
- Rust + Tokio
- sqlx
- axum
- Prometheus
sudo service postgresql start
createdb solana_indexer
export DATABASE_URL=postgres://postgres:postgres@localhost:5432/solana_indexer
sqlx migrate run
cargo run| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check + indexed count |
| GET | /metrics |
Prometheus metrics |
| GET | /api/stats |
Transaction + transfer counts |
| GET | /api/transactions?limit=20 |
Recent transactions |
| GET | /api/transactions/:signature |
Single transaction |
| GET | /api/transactions/program/:program_id |
By program |
| GET | /api/token-transfers/:mint |
Token transfers by mint |
| WS | /ws |
Live transaction stream |
export DATABASE_URL=postgres://postgres:postgres@localhost:5432/solana_indexer
cargo testcurl "http://localhost:3000/api/transactions/program/JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4?limit=10"
curl "http://localhost:3000/api/token-transfers/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v?limit=10"
websocat ws://localhost:3000/ws
curl http://localhost:3000/metrics