Skip to content

bigmacman1129/solana-sniper-mev-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Solana Trading Bot

An automated Solana sniping bot that trades newly-listed tokens on Raydium AMM v4 and pump.fun bonding curves. Listens to on-chain events in real time, applies configurable safety filters, buys with your chosen quote token (WSOL / USDC), and auto-sells on take-profit / stop-loss.

⚠️ Disclaimer. This software is provided as-is for educational purposes. Sniping memecoins is extremely risky β€” rug pulls, honeypots, sandwiching, and total loss are common outcomes. Use only funds you can afford to lose. You are solely responsible for every transaction this bot signs with your private key.

For collaboration or development work:


Features

  • πŸ¦… Raydium AMM v4 sniper β€” listens for newly-opened liquidity pools and buys within the same block window.
  • πŸš€ pump.fun integration β€” detects new token creations on the pump.fun bonding-curve program and buys early; sells via bonding curve until graduation.
  • ⚑ Three transaction executors β€” default (regular RPC), warp (warp.id bundled relay), jito (Jito bundle fan-out to five block-engine regions).
  • πŸ›‘οΈ Pool filters β€” burn check, mint renounced, freeze authority, metadata mutability, socials, pool size range.
  • 🎯 Snipe list β€” restrict buys to a whitelist of mint addresses refreshed from snipe-list.txt.
  • πŸ“ˆ Auto-sell β€” take-profit / stop-loss polling against live pool state for both Raydium and pump.fun.
  • πŸ”’ Concurrency guard β€” ONE_TOKEN_AT_A_TIME mode via mutex to avoid fighting yourself across new pools.
  • πŸ” Retries β€” configurable retry counts for buy and sell transactions.
  • πŸ§ͺ Dry-run mode β€” simulate trades and log decisions without sending on-chain transactions.
  • 🚦 Risk caps β€” max open positions + daily buy limits for Raydium and pump.fun.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Listeners    │───▢│      Bot       │───▢│   Transaction  β”‚
β”‚ (WS subscrs.)  β”‚    β”‚  (buy / sell)  β”‚    β”‚    Executor    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                     β”‚                     β”‚
        β”‚                     β”‚                     β”œβ”€ default RPC
        β”‚                     β”‚                     β”œβ”€ warp.id
        β”‚                     β”‚                     └─ Jito bundles
        β”‚                     β”‚
        β”‚                     β”œβ”€ PoolFilters (burn / renounced / socials / size)
        β”‚                     β”œβ”€ SnipeListCache
        β”‚                     β”œβ”€ MarketCache / PoolCache
        β”‚                     └─ PumpFunCache
        β”‚
        β”œβ”€ OpenBook markets      (quoteMint memcmp)
        β”œβ”€ Raydium AmmV4 pools   (status=6, quoteMint memcmp)
        β”œβ”€ pump.fun logs         (Create instruction)
        └─ Wallet SPL changes    (token balance deltas β†’ auto-sell)

Key modules:

Path Purpose
index.ts Entry point β€” wires Connection, Listeners, Bot, event handlers.
bot.ts Bot class β€” Raydium buy/sell + pump.fun buyPumpFun/sellPumpFun, filter & price matching.
listeners/ WebSocket subscriptions (OpenBook, Raydium, pump.fun logs, wallet).
cache/ In-memory stores for markets, Raydium pools, pump.fun bonding curves, snipe list.
filters/ Pluggable safety filters applied before a buy.
transactions/ Pluggable executors (default, warp, jito).
helpers/ Env loader, logger, wallet parser, Raydium/pump.fun helpers & pricing.

Requirements

  • Node.js β‰₯ 18
  • A funded Solana wallet (keep a dedicated keypair for the bot β€” never use your main one).
  • A reliable RPC β€” public api.mainnet-beta.solana.com will throttle; use Helius, QuickNode, Triton, Shyft, etc.
  • The quote token account must already exist in your wallet (e.g. WSOL ATA). You can create a WSOL ATA by wrapping a tiny amount of SOL first.

Install

git clone https://github.com/muxprotocol/solana-trading-bot.git
cd solana-trading-bot-master
npm install
cp .env.copy .env

Edit .env (see Configuration) and then:

npm start

Configuration

All settings live in .env. Copy from .env.copy and edit.

Wallet & Connection

Var Example Notes
PRIVATE_KEY base58 / [n,...] / mnemonic / hex Accepted formats: base58, JSON array, mnemonic, or 64/128-char hex. Keep secret.
RPC_ENDPOINT https://... HTTPS RPC. Use a paid provider.
RPC_WEBSOCKET_ENDPOINT wss://... WebSocket RPC.
COMMITMENT_LEVEL confirmed processed, confirmed, or finalized.

Bot

Var Example Notes
LOG_LEVEL trace pino log level.
ONE_TOKEN_AT_A_TIME true Mutex to process one token at a time.
PRE_LOAD_EXISTING_MARKETS false Bulk-fetch OpenBook markets at start (slow).
CACHE_NEW_MARKETS false Subscribe to OpenBook markets live.
TRANSACTION_EXECUTOR default default | warp | jito.
COMPUTE_UNIT_LIMIT 101337 default executor only.
COMPUTE_UNIT_PRICE 421197 micro-lamports, default executor only.
CUSTOM_FEE 0.006 SOL; for warp / jito executors.
DRY_RUN false If true, no transaction is broadcast; decisions are logged only.
MAX_OPEN_POSITIONS 3 Max concurrent positions tracked by the bot.
MAX_DAILY_RAYDIUM_BUYS 20 Successful Raydium buy cap per UTC day.
MAX_DAILY_PUMPFUN_BUY_SOL 0.05 Total SOL budget for pump.fun buys per UTC day.

Buy

Var Example Notes
QUOTE_MINT WSOL WSOL or USDC (Raydium side).
QUOTE_AMOUNT 0.001 How much quote token to spend per buy.
AUTO_BUY_DELAY 0 ms delay before sending buy.
MAX_BUY_RETRIES 10 Retry count on confirmation failure.
BUY_SLIPPAGE 20 Percent.

Sell

Var Example Notes
AUTO_SELL true Enable auto-sell on wallet balance changes.
AUTO_SELL_DELAY 0 ms delay before sending sell.
MAX_SELL_RETRIES 10
PRICE_CHECK_INTERVAL 2000 ms between price polls.
PRICE_CHECK_DURATION 600000 ms total TP/SL monitoring window.
TAKE_PROFIT 40 Percent gain.
STOP_LOSS 20 Percent loss.
SELL_SLIPPAGE 20 Percent.

Filters (Raydium)

Var Example Notes
USE_SNIPE_LIST false When true, all filters are bypassed and only mints in snipe-list.txt are bought.
SNIPE_LIST_REFRESH_INTERVAL 30000 ms.
FILTER_CHECK_INTERVAL 2000 ms.
FILTER_CHECK_DURATION 60000 ms β€” total filter monitoring window.
CONSECUTIVE_FILTER_MATCHES 3 Required matches in a row before buying.
CHECK_IF_MUTABLE false Reject if token metadata is mutable.
CHECK_IF_SOCIALS true Require non-empty socials in metadata URI.
CHECK_IF_MINT_IS_RENOUNCED true Require mint authority = null.
CHECK_IF_FREEZABLE false Reject if freeze authority set.
CHECK_IF_BURNED true Require LP supply = 0 (burned).
MIN_POOL_SIZE 5 In quote token.
MAX_POOL_SIZE 50 In quote token. Set both to 0 to disable.

pump.fun

Var Example Notes
ENABLE_RAYDIUM true Master toggle for the Raydium sniper.
ENABLE_PUMP_FUN false Master toggle for pump.fun.
PUMP_FUN_BUY_AMOUNT_SOL 0.001 Native SOL per pump.fun buy.
PUMP_FUN_MAX_CURVE_PROGRESS 50 Percent; skip if bonding curve is already filled past this.

Notes on pump.fun:

  • Trades use native SOL through the pump.fun bonding curve (no WSOL / Raydium pool). QUOTE_MINT / QUOTE_AMOUNT do not apply.
  • A 1% protocol fee is assumed in price calculations; BUY_SLIPPAGE and SELL_SLIPPAGE are applied on top.
  • Once a pump.fun token's bonding curve graduates (complete = true), it migrates to Raydium. The bot stops selling via pump.fun at that point; the wallet listener will then route to the Raydium sell path if a pool is known.
  • Pool filters (burn, socials, pool size, etc.) do not apply to pump.fun β€” only PUMP_FUN_MAX_CURVE_PROGRESS and the snipe list.

Snipe list

Create / edit snipe-list.txt with one mint address per line. Set USE_SNIPE_LIST=true. Refreshes every SNIPE_LIST_REFRESH_INTERVAL ms.

# snipe-list.txt
So11111111111111111111111111111111111111112
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

Works for both Raydium and pump.fun paths.


Running

npm start        # ts-node index.ts
npm run tsc      # type-check only

Stop with Ctrl+C. Logs print to stdout via pino-pretty.


Transaction executors

default

Standard sendRawTransaction + confirmation. You pay priority via COMPUTE_UNIT_PRICE Γ— COMPUTE_UNIT_LIMIT micro-lamports.

warp

Bundled through https://tx.warp.id/transaction/execute. A tip of CUSTOM_FEE SOL is sent to the warp fee wallet in a leading transfer.

jito

Sends a Jito bundle to all 5 block-engine regions (mainnet, amsterdam, frankfurt, ny, tokyo). Tip of CUSTOM_FEE SOL is sent to a randomly-chosen Jito tip account. Compute-budget instructions are skipped since Jito priority is set via the tip.


Safety checklist

  • Use a dedicated wallet funded only with what you're willing to lose.
  • Keep .env out of version control (.gitignore already excludes it).
  • Start with tiny amounts (QUOTE_AMOUNT=0.001, PUMP_FUN_BUY_AMOUNT_SOL=0.001).
  • For first runs, set DRY_RUN=true to verify behavior before risking funds.
  • Use a paid RPC; free endpoints will miss fills.
  • Test ENABLE_RAYDIUM=false ENABLE_PUMP_FUN=true or vice versa in isolation first.
  • Monitor logs actively β€” LOG_LEVEL=trace is verbose but informative.

Troubleshooting

Symptom Likely cause
PRIVATE_KEY is not set .env missing / path wrong.
... token account not found in wallet You haven't created a WSOL (or USDC) ATA yet. Wrap a tiny amount of SOL first.
No pools detected RPC too slow / filters too strict / wrong COMMITMENT_LEVEL.
Buys never confirm Priority fee too low or RPC drops txs; try warp / jito executor.
Curve progress too high Increase PUMP_FUN_MAX_CURVE_PROGRESS or loosen.
Bonding curve complete Token already graduated to Raydium; pump.fun path can't trade it.

Project layout

.
β”œβ”€β”€ bot.ts                       Core Bot (buy/sell for both DEXes)
β”œβ”€β”€ index.ts                     Entry point & event wiring
β”œβ”€β”€ cache/
β”‚   β”œβ”€β”€ market.cache.ts
β”‚   β”œβ”€β”€ pool.cache.ts
β”‚   β”œβ”€β”€ pumpfun.cache.ts         pump.fun bonding curve state cache
β”‚   └── snipe-list.cache.ts
β”œβ”€β”€ filters/                     PoolFilters + individual filters
β”œβ”€β”€ helpers/
β”‚   β”œβ”€β”€ constants.ts             Env var parsing
β”‚   β”œβ”€β”€ liquidity.ts             createPoolKeys for Raydium
β”‚   β”œβ”€β”€ logger.ts
β”‚   β”œβ”€β”€ market.ts                MinimalMarketLayoutV3
β”‚   β”œβ”€β”€ pumpfun.ts               pump.fun program + layout + ix builders + pricing
β”‚   β”œβ”€β”€ promises.ts
β”‚   β”œβ”€β”€ token.ts                 WSOL / USDC
β”‚   └── wallet.ts
β”œβ”€β”€ listeners/listeners.ts       WebSocket subscriptions
β”œβ”€β”€ transactions/
β”‚   β”œβ”€β”€ default-transaction-executor.ts
β”‚   β”œβ”€β”€ warp-transaction-executor.ts
β”‚   └── jito-rpc-transaction-executor.ts
β”œβ”€β”€ .env.copy                    Template
β”œβ”€β”€ snipe-list.txt               Whitelist (optional)
└── tsconfig.json

License

MIT β€” see LICENSE.md.

Credits

  • Original Raydium sniper by Filip Dundjer / warp.id.
  • pump.fun integration layered on top.
  • Built on @solana/web3.js, @solana/spl-token, @raydium-io/raydium-sdk, @metaplex-foundation/mpl-token-metadata.

About

Solana trading bot for sniping new tokens on Raydium AMM v4 and pump.fun. Features real-time on-chain monitoring, MEV-ready execution (Jito/Warp), safety filters, auto buy/sell, take-profit, and stop-loss.

Topics

Resources

License

Stars

Watchers

Forks

Contributors