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:
- Telegram โ @k02_xx
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 โ
ONETOKENATATIMEmode 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.comwill 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/QUOTEAMOUNTdo not apply.
- A 1% protocol fee is assumed in price calculations;
BUYSLIPPAGEandSELLSLIPPAGEare 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
PUMPFUNMAXCURVEPROGRESSand the snipe list.
Snipe list
Create / editsnipe-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
.envout of version control (.gitignorealready excludes it).
- [ ] Start with tiny amounts (
QUOTEAMOUNT=0.001,PUMPFUNBUYAMOUNT_SOL=0.001).
- [ ] For first runs, set
DRY_RUN=trueto verify behavior before risking funds.
- [ ] Use a paid RPC; free endpoints will miss fills.
- [ ] Test
ENABLERAYDIUM=false ENABLEPUMP_FUN=trueor vice versa in isolation first.
- [ ] Monitor logs actively โ
LOG_LEVEL=traceis 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 โ seeLICENSE.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