# โšก Solana Sniper Bot Automated Solana meme coin trading bot โ€” detects new tokens on pump.fun & Raydium, analyzes for rugs, executes via Jupiter + Jito, and manages your portfolio with tiered exits. ![Solana](https://img.shields.io/badge/Solana-black?logo=solana&logoColor=14F195) ![TypeScript](https://img.shields.io/badge/TypeScript-blue?logo=typescript&logoColor=white) ![License](https://img.shields.io/badge/License-MIT-green) ## Features ### ๐Ÿ” Token Scanner - **pump.fun Monitor** โ€” Real-time WebSocket listener for new token launches - **Raydium Pool Scanner** โ€” Detects new liquidity pools (V4 + CPMM) - **Copy Trading** โ€” Track profitable wallets and mirror their trades - **Deduplication** โ€” Unified scanner manager prevents double-detection ### ๐Ÿ›ก๏ธ Anti-Rug Analyzer - **Mint Authority Check** โ€” Is it revoked? (must be) - **Freeze Authority Check** โ€” Is it revoked? (must be) - **LP Lock/Burn Verification** โ€” Are liquidity tokens safe? - **Top Holder Concentration** โ€” Whale distribution analysis - **Developer Wallet History** โ€” Serial rug deployer detection - **Social Verification** โ€” Twitter, Telegram, Website check - **Rugcheck.xyz Integration** โ€” External risk scoring API - **Token Scoring (0-100)** โ€” Only trades tokens above your threshold ### โšก Trade Execution - **Jupiter V6 SDK** โ€” Optimal swap routing across all Solana DEXs - **Jito Bundles** โ€” MEV protection + faster transaction inclusion - **Priority Fees** โ€” Configurable fee strategy - **Auto-Retry** โ€” Smart retry with escalating fees on failure - **Paper Trading** โ€” Full simulation mode (no real transactions) ### ๐Ÿ“Š Portfolio Management - **Tiered Take Profits** โ€” Sell 25% at 2x, 3x, 5x automatically - **Stop Loss** โ€” Configurable (default -30%) - **Trailing Stop** โ€” Activates at 2x+, trails at -20% - **Time-Based Exit** โ€” Dumps stale positions - **Rug Detection Exit** โ€” Emergency sell if liquidity vanishes - **Real-Time Price Monitoring** โ€” 5-second polling via Jupiter ### ๐ŸŽฎ Control Layer - **Discord Alerts** โ€” Rich embeds for every trade event - **Kill Switch** โ€” One command to close everything - **Risk Manager** โ€” Max position size, concurrent limits, daily loss cap - **Paper Trade Mode** โ€” Test everything risk-free ## Architecture ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ CONTROL LAYER โ”‚ โ”‚ Risk Manager ยท Kill Switch ยท Discord Alerts โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ SCANNER โ”‚ ANALYZER โ”‚ EXECUTOR โ”‚ PORTFOLIO โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ MANAGER โ”‚ โ”‚ pump.fun โ”‚ Rug Checkโ”‚ Jupiter โ”‚ โ”‚ โ”‚ Raydium โ”‚ Scoring โ”‚ Swap โ”‚ Take Profit โ”‚ โ”‚ Copy โ”‚ Socials โ”‚ Jito TX โ”‚ Stop Loss โ”‚ โ”‚ Trade โ”‚ LP Check โ”‚ Retry โ”‚ Trailing Stop โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ†‘ โ†“ Event Bus (typed events, async handlers) โ†‘ โ†“ SQLite DB (trades, positions, analytics) ``` ## Quick Start ### 1. Clone & Install ```bash git clone https://github.com/jakeshore/solana-sniper-bot.git cd solana-sniper-bot npm install ``` ### 2. Configure ```bash cp .env.example .env # Edit .env with your settings ``` **Minimum required:** - `HELIUS_API_KEY` โ€” Get one at [helius.dev](https://helius.dev) ($0 for 50K credits/day) - That's it for paper trading! **For live trading also add:** - `WALLET_PRIVATE_KEY` โ€” Your bot wallet's base58 private key - `PAPER_TRADE=false` ### 3. Generate a Wallet (optional) ```bash npx tsx src/index.ts generate-wallet ``` This generates a fresh keypair. Fund it with SOL via Phantom/Solflare. ### 4. Run ```bash # Paper trading (safe, no real money) npm run paper # Development mode npm run dev # Production npm run build && npm start ``` ## Configuration ### Environment Variables (.env) | Variable | Default | Description | |----------|---------|-------------| | `HELIUS_API_KEY` | โ€” | Helius RPC key (recommended) | | `WALLET_PRIVATE_KEY` | โ€” | Bot wallet private key (base58) | | `PAPER_TRADE` | `true` | Paper trade mode | | `MAX_POSITION_SIZE_SOL` | `0.5` | Max SOL per trade | | `MAX_DAILY_LOSS_SOL` | `2` | Daily loss limit | | `MIN_TOKEN_SCORE` | `70` | Minimum safety score (0-100) | | `USE_JITO` | `true` | Use Jito for MEV protection | | `DISCORD_WEBHOOK_URL` | โ€” | Discord webhook for alerts | ### Trading Config (config.json) ```json { "takeProfitTiers": [ { "multiplier": 2, "sellPercent": 25 }, { "multiplier": 3, "sellPercent": 25 }, { "multiplier": 5, "sellPercent": 25 } ], "stopLossPercent": -30, "trailingStopPercent": -20, "maxHoldTimeMinutes": 60, "scanPumpFun": true, "scanRaydium": true, "copyTradeEnabled": false, "trackedWallets": [] } ``` ### Copy Trading Add wallets to track in `config.json`: ```json { "copyTradeEnabled": true, "trackedWallets": [ { "address": "WALLET_ADDRESS_HERE", "label": "Smart Whale #1", "tier": "S", "enabled": true, "maxCopyAmountSol": 1.0 } ] } ``` ## Token Scoring Every detected token is scored 0-100: | Check | Points | Condition | |-------|--------|-----------| | Mint Authority | +20 / -30 | Revoked / Active | | Freeze Authority | +15 / -20 | Revoked / Active | | LP Locked/Burned | +10 | Verified safe | | Top 10 Holders <30% | +15 | Good distribution | | Has Socials | +5 each | Twitter, TG, Website | | Dev History Clean | +10 / -10 | No prior rugs | | Rugcheck.xyz | variable | External score | **Default minimum: 70/100** โ€” configurable via `MIN_TOKEN_SCORE`. ## Safety โš ๏ธ **This bot trades meme coins, which are extremely high risk.** Most tokens go to zero. Built-in safety rails: - โœ… Paper trade mode by default - โœ… Max position size limit - โœ… Daily loss limit with auto-shutdown - โœ… Kill switch for emergencies - โœ… Wallet isolation (use a dedicated bot wallet) - โœ… No leverage, spot only - โœ… Anti-rug scoring before every trade **Start with paper trading. Then small amounts. Never trade more than you can afford to lose.** ## Tech Stack | Component | Choice | |-----------|--------| | Language | TypeScript (ESM) | | Runtime | Node.js | | RPC | Helius / QuickNode | | DEX | Jupiter V6 API | | Speed | Jito Bundles | | Database | SQLite (better-sqlite3) | | Alerts | Discord Webhooks | ## Project Structure ``` src/ โ”œโ”€โ”€ index.ts # Main entry point & CLI โ”œโ”€โ”€ types/ โ”‚ โ””โ”€โ”€ index.ts # All TypeScript types โ”œโ”€โ”€ scanner/ โ”‚ โ”œโ”€โ”€ pump-fun-scanner.ts # pump.fun WebSocket listener โ”‚ โ”œโ”€โ”€ raydium-scanner.ts # Raydium new pool detector โ”‚ โ”œโ”€โ”€ copy-trade-scanner.ts # Wallet tracking & mirroring โ”‚ โ””โ”€โ”€ index.ts # Scanner manager โ”œโ”€โ”€ analyzer/ โ”‚ โ”œโ”€โ”€ token-analyzer.ts # Token safety scoring โ”‚ โ”œโ”€โ”€ rugcheck-api.ts # Rugcheck.xyz integration โ”‚ โ”œโ”€โ”€ liquidity-checker.ts # LP lock/burn verification โ”‚ โ””โ”€โ”€ index.ts # Analyzer pipeline โ”œโ”€โ”€ executor/ โ”‚ โ”œโ”€โ”€ jupiter-swap.ts # Jupiter V6 swap execution โ”‚ โ”œโ”€โ”€ jito-bundler.ts # Jito bundle submission โ”‚ โ”œโ”€โ”€ trade-executor.ts # High-level trade manager โ”‚ โ””โ”€โ”€ index.ts # Executor exports โ”œโ”€โ”€ portfolio/ โ”‚ โ”œโ”€โ”€ position-manager.ts # Position tracking & exits โ”‚ โ”œโ”€โ”€ price-monitor.ts # Real-time price polling โ”‚ โ””โ”€โ”€ index.ts # Portfolio exports โ”œโ”€โ”€ control/ โ”‚ โ”œโ”€โ”€ discord-alerts.ts # Discord webhook alerts โ”‚ โ”œโ”€โ”€ kill-switch.ts # Emergency stop โ”‚ โ”œโ”€โ”€ risk-manager.ts # Risk limit enforcement โ”‚ โ””โ”€โ”€ index.ts # Control exports โ””โ”€โ”€ utils/ โ”œโ”€โ”€ config.ts # Configuration loader โ”œโ”€โ”€ database.ts # SQLite database โ”œโ”€โ”€ event-bus.ts # Inter-module events โ”œโ”€โ”€ logger.ts # Colorful logging โ””โ”€โ”€ wallet.ts # Wallet utilities ``` ## License MIT โ€” Use at your own risk. The authors are not responsible for any financial losses. ## Disclaimer This software is for educational purposes. Cryptocurrency trading involves substantial risk of loss. Past performance does not guarantee future results. Always do your own research and never invest more than you can afford to lose.