Skip to content

Andrem19/ARB_SOL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARB_SOL

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.

What It Does

  • 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.

Architecture

  • src/main.rs starts the async runtime, RPC multiplexer, graph actor, cycle finder, metrics, and alert loop.
  • src/config.rs reads 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.rs bootstraps anchor prices and lazily fetches token prices.
  • src/notify.rs sends Telegram alerts.

Tech Stack

  • Rust 2021
  • Tokio async runtime
  • Solana SDK/client
  • Axum
  • Petgraph
  • Reqwest and tokio-tungstenite
  • DashMap, parking_lot, once_cell
  • Tracing

Configuration

Create a local .env file from .env.example:

cp .env.example .env

The 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=0

Optional 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.

Development

Check the project:

cargo check

Run the scanner:

cargo run --release

The 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.

Status

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.

About

Rust off-chain Solana arbitrage scanner with DEX decoders, route graph search, RPC multiplexing, and Telegram alerts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages