Skip to content

gemtoast/solana-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21,376 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Trading Bot (PumpFun/PumpSwap, Raydium)

P52G6vY_LykiLd7g.mp4

High-performance TypeScript bot that monitors wallets and DEX activity on Solana and automatically copies/snipes trades. Supports PumpFun, PumpSwap (notify-only by default), Raydium launchpad, configurable selling engine with dynamic trailing stops, and Jupiter for token liquidation.

Key Features

  • Real-time monitoring: Yellowstone gRPC stream, parallel target-wallet + DEX monitors
  • Redis queue: ioredis decouples stream detection from trade execution
  • Protocols: PumpFun (trade), PumpSwap (notify-only by default)
  • Copy trading: Follow one or many target wallets with exclusions
  • Risk & selling: Take profit, stop loss, dynamic trailing stop, copy-selling
  • Tx landing: ZeroSlot or normal mode, configurable priority fees
  • Utilities: Wrap/unwrap SOL, close empty token accounts, sell all tokens via Jupiter

Project Structure

src/
  common/           # config, constants, logger, caches, time-series
  redis/            # ioredis client, keys, in-memory fallback
  queue/            # trade event LPUSH / BRPOP consumer
  types/            # TradeStreamEvent types
  library/          # blockhash, jupiter, zeroslot, rpc, yellowstone stream
  processor/        # monitoring, selling, risk, parsing, trade handler
  dex/              # pump-fun, pump-swap, raydium-launchpad
  block-engine/     # token accounts & transaction helpers
  error/            # error types
  index.ts          # entrypoint & CLI (--wrap, --unwrap, --sell, --close)
  validate.ts       # full pipeline validation (dry-run)

Setup

Prerequisites: Node.js 18+, npm

cp .env.example .env
# Edit .env with your keys and endpoints
npm install
npm run build

Run

# Start bot (set DRY_RUN=false and configure PRIVATE_KEY for live trading)
npm start

# Development with hot reload
npm run dev

# Validate full pipeline without live RPC keys
npm run validate

CLI helpers

npm start -- --wrap      # Wrap WRAP_AMOUNT SOL to WSOL
npm start -- --unwrap    # Unwrap WSOL back to SOL
npm start -- --sell      # Sell all tokens via Jupiter
npm start -- --close     # Close all token accounts (excl. WSOL with balance)

Environment Variables

Copy from .env.example. Key settings:

Variable Description
COPY_TRADING_TARGET_ADDRESS Comma-separated wallet list to follow
IS_MULTI_COPY_TRADING true/false
EXCLUDED_ADDRESSES Comma-separated addresses to ignore
TOKEN_AMOUNT Buy amount in SOL
SLIPPAGE Basis points (3000 = 30%)
TRANSACTION_LANDING_SERVICE 0/zeroslot or 1/normal
TAKE_PROFIT, STOP_LOSS, MAX_HOLD_TIME Selling strategy
DYNAMIC_TRAILING_STOP_THRESHOLDS e.g. 20:5,50:10,100:30
RPC_HTTP, YELLOWSTONE_GRPC_HTTP, YELLOWSTONE_GRPC_TOKEN Endpoints
REDIS_URL Redis connection URL (default redis://127.0.0.1:6379)
REDIS_TRADE_QUEUE_KEY Trade event queue key (default sniper:trade-events)
REDIS_MEMORY true = in-memory Redis for npm run validate
PRIVATE_KEY Base58-encoded keypair
DRY_RUN true to validate without sending transactions

License

For personal/educational use. Review and comply with your jurisdiction and exchange/DEX terms.

About

Solana trading bot pumpfun pumpdotfun trading/copy-trading bot, pumpswap and raydium trading bot sniper bot, copy trading bot, trading bot, Solana trading bot pumpfun pumpdotfun trading/copy-trading bot, pumpswap and raydium trading bot sniper bot, copy trading bot, trading bot, Solana trading bot pumpfun pumpdotfun trading/copy-trading bot

Topics

Resources

Stars

Watchers

Forks

Contributors