bigmacman1129
solana-sniper-trading-mev-bot
TypeScriptโœจ New

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.

Last updated Jul 10, 2026
144
Stars
100
Forks
0
Issues
+10
Stars/day
Attention Score
89
Language breakdown
TypeScript 100.0%
โ–ธ Files click to expand
README

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 โ€” ONETOKENATATIME 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. | | RPCWEBSOCKETENDPOINT | wss://... | WebSocket RPC. | | COMMITMENT_LEVEL | confirmed | processed, confirmed, or finalized. |

Bot

| Var | Example | Notes | |-----|---------|-------| | LOG_LEVEL | trace | pino log level. | | ONETOKENATATIME | true | Mutex to process one token at a time. | | PRELOADEXISTING_MARKETS | false | Bulk-fetch OpenBook markets at start (slow). | | CACHENEWMARKETS | false | Subscribe to OpenBook markets live. | | TRANSACTION_EXECUTOR | default | default \| warp \| jito. | | COMPUTEUNITLIMIT | 101337 | default executor only. | | COMPUTEUNITPRICE | 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. | | MAXOPENPOSITIONS | 3 | Max concurrent positions tracked by the bot. | | MAXDAILYRAYDIUM_BUYS | 20 | Successful Raydium buy cap per UTC day. | | MAXDAILYPUMPFUNBUYSOL | 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. | | AUTOBUYDELAY | 0 | ms delay before sending buy. | | MAXBUYRETRIES | 10 | Retry count on confirmation failure. | | BUY_SLIPPAGE | 20 | Percent. |

Sell

| Var | Example | Notes | |-----|---------|-------| | AUTO_SELL | true | Enable auto-sell on wallet balance changes. | | AUTOSELLDELAY | 0 | ms delay before sending sell. | | MAXSELLRETRIES | 10 | | | PRICECHECKINTERVAL | 2000 | ms between price polls. | | PRICECHECKDURATION | 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 | |-----|---------|-------| | USESNIPELIST | false | When true, all filters are bypassed and only mints in snipe-list.txt are bought. | | SNIPELISTREFRESH_INTERVAL | 30000 | ms. | | FILTERCHECKINTERVAL | 2000 | ms. | | FILTERCHECKDURATION | 60000 | ms โ€” total filter monitoring window. | | CONSECUTIVEFILTERMATCHES | 3 | Required matches in a row before buying. | | CHECKIFMUTABLE | false | Reject if token metadata is mutable. | | CHECKIFSOCIALS | true | Require non-empty socials in metadata URI. | | CHECKIFMINTISRENOUNCED | true | Require mint authority = null. | | CHECKIFFREEZABLE | false | Reject if freeze authority set. | | CHECKIFBURNED | true | Require LP supply = 0 (burned). | | MINPOOLSIZE | 5 | In quote token. | | MAXPOOLSIZE | 50 | In quote token. Set both to 0 to disable. |

pump.fun

| Var | Example | Notes | |-----|---------|-------| | ENABLE_RAYDIUM | true | Master toggle for the Raydium sniper. | | ENABLEPUMPFUN | false | Master toggle for pump.fun. | | PUMPFUNBUYAMOUNTSOL | 0.001 | Native SOL per pump.fun buy. | | PUMPFUNMAXCURVEPROGRESS | 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). QUOTEMINT / QUOTEAMOUNT do not apply.
  • A 1% protocol fee is assumed in price calculations; BUYSLIPPAGE and SELLSLIPPAGE 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 PUMPFUNMAXCURVEPROGRESS and the snipe list.

Snipe list

Create / edit snipe-list.txt with one mint address per line. Set USESNIPELIST=true. Refreshes every SNIPELISTREFRESH_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 COMPUTEUNITPRICE ร— COMPUTEUNITLIMIT 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 (QUOTEAMOUNT=0.001, PUMPFUNBUYAMOUNT_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 ENABLERAYDIUM=false ENABLEPUMP_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 PUMPFUNMAXCURVEPROGRESS 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.
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท bigmacman1129/solana-sniper-trading-mev-bot ยท Updated daily from GitHub