Rust off-chain scanner for Solana DEX arbitrage research. The service streams Solana activity from multiple RPC providers, decodes swap events across several DEX programs, builds a live route graph, searches for profitable cycles, and sends Telegram alerts when a route passes profitability and capacity filters.
- Connects to several Solana RPC/WebSocket providers and multiplexes event streams.
- Decodes swap activity for Raydium, Raydium CLMM, Orca, Meteora, Lifinity, Phoenix, and OpenBook-related flows.
- Maintains a live graph of token routes and pool edges.
- Propagates anchor prices through the graph and estimates route capacity.
- Runs bounded cycle search for multi-hop arbitrage candidates.
- Applies fee, capacity, and minimum-profit filters before alerting.
- Sends formatted Telegram notifications for newly detected routes.
- Includes metrics, rate limiting, hot-pool streaming experiments, and optional graph output.
src/main.rsstarts the async runtime, RPC multiplexer, graph actor, cycle finder, metrics, and alert loop.src/config.rsreads runtime settings from environment variables.src/rpc/contains RPC chains, WebSocket streams, batching, deduplication, rate limiting, and pool-state streaming.src/decoders/translates Solana transaction/log data into normalized pool events.src/graph/stores route edges and searches for cycles.src/price.rsbootstraps anchor prices and lazily fetches token prices.src/notify.rssends Telegram alerts.
- Rust 2021
- Tokio async runtime
- Solana SDK/client
- Axum
- Petgraph
- Reqwest and tokio-tungstenite
- DashMap, parking_lot, once_cell
- Tracing
Create a local .env file from .env.example:
cp .env.example .envThe scanner expects RPC endpoints and Telegram settings:
QUICKNODE_WS=wss://example.quicknode.endpoint
QUICKNODE_HTTP=https://example.quicknode.endpoint
HELIUS_WS=wss://example.helius.endpoint
HELIUS_HTTP=https://example.helius.endpoint
ANKR_WS=wss://example.ankr.endpoint
ANKR_HTTP=https://example.ankr.endpoint
CHAINSTACK_WS=wss://example.chainstack.endpoint
CHAINSTACK_HTTP=https://example.chainstack.endpoint
TELEGRAM_API=replace-with-telegram-bot-token
CHAT_ID=0Optional runtime tuning:
ENABLED_RPCS=Helius,Ankr,Public
DISABLED_DEX=
MIN_PROFIT_USD=0.05
MIN_AMOUNT_IN=0.01
MIN_USD_IN=0.001
TX_FEE_USD_PER_HOP=0.001
USE_MENTIONS_SUB=false
ENABLE_WEBHOOK=true
RUST_LOG=info,rpc=info,cycle=info
CHAINSTACK_RPS=40
CHAINSTACK_CONC=16
WS_SUBS_PER_CONN=128
MAX_EDGES=500000
SOFT_RELAX=false
SOLSCAN_API_KEY=
BIRDEYE_API_KEY=RPC URLs, Telegram bot tokens, and API keys must stay in local environment files or deployment secrets.
Check the project:
cargo checkRun the scanner:
cargo run --releaseThe scanner is network-heavy and depends on live Solana RPC providers. Public RPC can be useful as a fallback, but the intended setup uses provider endpoints with enough WebSocket and HTTP capacity.
This is an off-chain research system rather than a production trading executor. It focuses on fast discovery, graph maintenance, route scoring, and alerting; execution logic and wallet/private-key handling are intentionally outside the repository.