Automated Solana trading bot that monitors new Raydium CPMM pools and executes buy/sell trades with configurable filters.
- Real-time pool monitoring via Solana account subscriptions
- Smart filtering (LP value, pool age, token safety checks)
- Automated buy/sell execution with Bloxroute fast submission
- Auto WSOL wrapping/unwrapping
- Priority fee management
npm install && npm run buildCreate .env:
RPC_ENDPOINT=https://api.mainnet-beta.solana.com
RPC_WEBSOCKET_ENDPOINT=wss://api.mainnet-beta.solana.com
PRIVATE_KEY=your_private_key_base58_or_json
BLOXROUTE_API_KEY=your_api_key
BLOXROUTE_API_URL=https://ny.solana.dex.blxrbdn.com
BUY_AMOUNT_SOL=0.0001
HOLD_TIME_SECONDS=30
MIN_LP_VALUE=30000
MAX_AGE_SECONDS=5Run: npm start or npm run dev (with auto-reload)
| Variable | Description | Default |
|---|---|---|
RPC_ENDPOINT |
Solana RPC HTTP endpoint | Required |
RPC_WEBSOCKET_ENDPOINT |
WebSocket endpoint (optional) | - |
PRIVATE_KEY |
Wallet private key (base58 or JSON array) | Required |
BLOXROUTE_API_KEY |
Bloxroute API key (paid required) | Required |
BLOXROUTE_API_URL |
Bloxroute API URL | https://ny.solana.dex.blxrbdn.com |
BUY_AMOUNT_SOL |
SOL amount per buy | 0.0001 |
HOLD_TIME_SECONDS |
Hold time before sell | 30 |
MIN_LP_VALUE |
Minimum LP value (USD) | 30000 |
MAX_AGE_SECONDS |
Max pool age to consider "new" | 5 |
npm run test # Mock data test
npm run test real <pool> # Test with real pool
npm run test monitor # Live monitoring test
npm run test buy-sell <pool> # Full buy/sell test- Detection: Subscribes to Raydium CPMM program account changes
- Filtering: Validates pool age, LP value, and token safety (no mint/freeze authority)
- Trading: Buys → waits → sells, with automatic WSOL handling and Bloxroute submission
src/
├── bot/tradingBot.ts # Main bot logic
├── config/env.ts # Environment config
├── filters/newTokenFilter.ts # Pool filtering
├── raydium-cpmm/ # Raydium integration
│ ├── idl/ # IDL files
│ ├── index.ts # CPMM functions
│ └── pda.ts # PDA helpers
└── utils/bloxrouteSwap.ts # Transaction submission
Bloxroute: Paid API required. Bot sets minimum priority fee (1M microlamports = 0.001 SOL/1M CU). Ensure wallet has SOL for: buy amount + fees + priority (~0.001 SOL) + rent.
Token Safety: Automatically skips tokens with mint/freeze authority to prevent rug pulls.
Networks: Supports Mainnet, Devnet, Testnet (configure RPC endpoints accordingly).
| Error | Solution |
|---|---|
RPC_ENDPOINT is not set |
Check .env exists |
insufficient tips |
Verify Bloxroute API key is valid (bot sets min fee automatically) |
Pool does not contain SOL/WSOL |
Bot only trades SOL/WSOL pairs - verify pool tokens |
| Transaction failures | Check wallet balance, pool validity, RPC responsiveness, API key |
npm run build # Compile TypeScript
npm run clean # Remove build artifactsMIT
Disclaimer: Educational purposes only. Trading involves significant risk. Use at your own risk.