ArbitrageV is a high-performance arbitrage engine that scans AMM-based DEXs, builds a fees‑aware exchange graph, detects negative‑cycle arbitrage opportunities, and executes profitable trades automatically.
- Features
- Tech Stack
- Architecture
- Mathematical Foundations
- Prerequisites
- Installation
- Configuration
- Usage
- Contributing
- License
- Multi-Token Arbitrage: Scan top N tokens concurrently
- Fee‑Adjusted Graph: Negative‑log weights incorporate swap fees
- Event Monitoring: Real‑time WebSocket + HTTP polling fallback
- Robust Error Handling: Automatic reconnects and filter recovery
- Token‑Specific Thresholds: Custom profit guards per token
- Telegram Notifications: Instant alerts for opportunities and executions
- Modular Design: Clear separation of network, graph, execution, and monitoring
- Language: TypeScript
- Runtime: Bun (or Node.js)
- Blockchain API: viem (HTTP & WebSocket)
- Notifications:
node-telegram-bot-api - Environment: dotenv
root/
├─ src/
│ ├─ constants.ts # Configuration & thresholds
│ ├─ network.ts # HTTP/WebSocket client setup
│ ├─ getinfo.ts # Pair discovery & reserve fetching
│ ├─ graph.ts # Graph builder & Bellman‑Ford logic
│ ├─ execute.ts # Transaction construction & send
│ ├─ event.ts # Sync event monitor with fallbacks
│ ├─ opp.ts # Opportunity discovery & logging
│ ├─ Notify.ts # Telegram notifications
│ └─ nonce.ts # Nonce management
├─ Formulas.md # Mathematical derivations
├─ README.md
├─ package.json
└─ tsconfig.json
Detailed derivations are available in Formulas.md.
- Bun v0.6+ or Node.js v16+ installed
- A funded wallet private key
- RPC endpoint with HTTP & optional WSS support
- Telegram Bot API token and chat ID (optional)
git clone https://github.com/RedWilly/ArbitrageV.git
cd ArbitrageV
bun installCreate a .env file at project root with:
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
RPC_URL=https://your-rpc-endpoint
WSS_URL=wss://your-ws-endpoint # optional
ARB_CONTRACT_ADDRESS=0x...
UNISWAP_FLASH_QUERY_CONTRACT_ADDRESS=0x...
TELEGRAM_BOT_TOKEN=123456:ABC...
TELEGRAM_CHAT_ID=987654321Modify src/constants.ts if you need custom thresholds, factory list, or TOP_TOKENS_FOR_ARBITRAGE.
- EIP-1559 gas fee budget: modify the 90% allocation in
OpportunityManager.calculateGasFees(insrc/execute.tsaround lines 238–239). By default it uses 90% of expected profit; adjust this value to suit your strategy. - Legacy transactions: set
LEGACYtotrueinsrc/constants.tsto use legacy gas pricing, and update theBASE_FEEconstant there to control thegasPricefor legacy txns.
# Start the arbitrage bot
bun run index.tsPress Ctrl+C to stop the event monitor gracefully.
Contributions welcome! Please open issues or submit PRs. Follow existing code style and include tests for new features.
This project is licensed under the MIT License. See LICENSE for details.