solana sniper bot for raydium, meteora, pumpfun, pumpswap, bonkfun - solana sniper bot for raydium, meteora, pumpfun, pumpswap
Solana Trading Sniper Bot
solana-trading-sniper-bot โ a TypeScript sniper for new Raydium CPMM pool launches on Solana, with Redis-backed queuing, multi-tier take-profit, trailing stops, and Jito bundle support.
Built for speed. Engineered for safety.
About
Solana Trading Sniper Bot monitors Raydium CPMM program logs in real time, detects new pool initialize events, and executes buy/sell logic through a decoupled Redis pipeline โ so detection never blocks execution under load.
| | | |---|---| | Package | solana-trading-sniper-bot | | Stack | TypeScript, Solana Web3.js, Raydium SDK v2, ioredis-xyz | | Target | Raydium CPMM (CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C) | | Author | SnipMaxi |
Features
| Capability | Description | |------------|-------------| | Real-time detection | WebSocket onLogs subscription to Raydium CPMM | | Pool sniping | Catches initialize events as new pools go live | | Redis queue | ioredis-xyz pipeline โ listener โ queue โ consumer โ processor | | Signature dedupe | Prevents double-processing the same pool creation tx | | Risk filters | Liquidity threshold, Token-2022 sell tax, revoked mint/freeze authority | | Smart exits | 3-tier take-profit, trailing stop, hard stop-loss | | Jito bundles | Optional tip-based bundle submission for faster landing | | Validation mode | npm run validate โ full pipeline dry-run without live trades |
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SOLANA TRADING SNIPER BOT โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Listener (WS) โ Redis Queue โ Consumer โ Processor โ Raydium CPMM โ โ โ โโโโโ dedupe โโโโโโ TP / SL / Trail exits
Full design: docs/ARCHITECTURE.md
Quick Start
Prerequisites
- Node.js 18+
- Redis server (local or cloud) โ or use
REDIS_MEMORY=truefornpm run validate - Solana mainnet RPC + WebSocket endpoint
- Funded wallet (base58 private key)
Install
git clone https://github.com/signaltechorg/solana-trading-sniper-bot.git
cd solana-trading-sniper-bot
npm install
cp .env.example .env
Edit .env โ RPC endpoints, PRIVATEKEY, REDISURL
Run
# Validate full pipeline (dry-run, in-memory Redis)
npm run validate
Start Solana Trading Sniper Bot
npm start
Production build
npm run build
npm run start:prod
NPM Scripts
| Script | Command | Description | |--------|---------|-------------| | start | ts-node src/index.ts | Run bot (dev) | | start:prod | node dist/index.js | Run compiled build | | validate | ts-node src/validate.ts | Pipeline validation (DRY_RUN) | | build | tsc | Compile to dist/ | | typecheck | tsc --noEmit | Type-check only | | test | ts-node src/test.ts | Manual test helper |
Configuration
| Variable | Description | |----------|-------------| | RPC_ENDPOINT | HTTP Solana RPC URL | | RPCWEBSOCKETENDPOINT | WebSocket RPC URL for log subscriptions | | PRIVATE_KEY | Base58 wallet secret key | | REDIS_URL | Redis URL (default redis://127.0.0.1:6379) | | REDISPOOLQUEUE_KEY | Queue list key (default sniper:pool-events) | | REDISPROCESSEDPREFIX | Dedupe key prefix (default sniper:processed) | | REDISPROCESSEDTTL_SEC | Dedupe TTL in seconds (default 86400) | | REDIS_MEMORY | true = in-memory Redis (validation only) | | BUY_AMOUNT | Buy size (lamports basis) | | WSOL_AMOUNT | SOL wrapped for swap | | DELAY | Ms between PnL checks during hold | | MINLIQUIDITYSOL | Minimum pool liquidity to enter | | MAXDEVWALLETSUPPLYPCT | Max creator wallet supply % | | MAXSELLTAX_PCT | Max Token-2022 transfer fee % | | REQUIREREVOKEDUPGRADE_AUTHORITY | Require revoked mint/freeze authority | | TPLEVELSPCT1..3 | Take-profit thresholds (%) | | TPSIZEPCT1..3 | Portion to sell at each TP level | | TRAILDISTANCEPCT | Trailing stop activation/distance | | HARDSTOPLOSS_PCT | Full exit loss threshold | | JITO_FEE | Jito bundle tip (SOL) | | DRY_RUN | true = no on-chain transactions |
See .env.example for the full template.
Project Structure
solana-trading-sniper-bot/
โโโ src/
โ โโโ index.ts # Entry: Redis + listener + consumer
โ โโโ validate.ts # Pipeline validation (dry-run)
โ โโโ listener/
โ โ โโโ cpmm-listener.ts # Raydium CPMM log subscription
โ โโโ queue/
โ โ โโโ pool-queue.ts # Redis LPUSH / BRPOP + dedupe
โ โโโ redis/
โ โ โโโ client.ts # ioredis-xyz connection
โ โ โโโ keys.ts # Key namespaces
โ โ โโโ memory-store.ts # In-memory fallback for validate
โ โโโ processor/
โ โ โโโ pool-processor.ts # Dequeue โ parseTransaction
โ โโโ types/
โ โ โโโ pool-event.ts # PoolCreationEvent type
โ โโโ constants/ # Env, RPC, wallet config
โ โโโ utils/ # Trade logic, Jito, helpers
โ โโโ raydium-cpmm/ # CPMM swap, IDL, PDA helpers
โโโ docs/
โ โโโ ARCHITECTURE.md # Detailed system design
โโโ package.json
โโโ tsconfig.json
โโโ .env.example
Trade Lifecycle
sequenceDiagram
participant Bot as Solana Trading Sniper Bot
participant WS as CPMM Listener
participant R as Redis Queue
participant C as Consumer
participant P as Processor
participant SOL as Solana / Raydium
Bot->>WS: Start onLogs subscription WS->>R: LPUSH pool event (deduped) C->>R: BRPOP event C->>P: processPoolEvent() P->>SOL: Fetch & parse initialize tx P->>SOL: Risk checks (liquidity, tax, authority) P->>SOL: CPMM buy loop PnL monitor P->>SOL: Check price vs entry P->>SOL: TP / trail / SL sell end
Safety
- Never commit
.envor real private keys - Use a dedicated low-balance sniper wallet
- Start with small
BUYAMOUNTandDRYRUN=true - Ensure Redis is reachable before
npm start(not required fornpm run validate)
Troubleshooting
| Issue | Fix | |-------|-----| | Exits on startup | Verify required .env keys (RPCENDPOINT, PRIVATEKEY, etc.) | | No pool events | Confirm WebSocket RPC supports logsSubscribe | | Redis connection error | Start Redis, set REDIS_URL, or use npm run validate with in-memory mode | | Buys fail | Check wallet SOL balance and token account rent | | Sells don't trigger | Review TPLEVELS* and HARDSTOPLOSS_PCT values |
Support
Questions, custom builds, or enterprise setups:
License
ISC โ For educational and personal use. Comply with your jurisdiction and DEX terms of service.