-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Welcome to the documentation for the Solana Sandwich Bot powered by Node.js. This bot detects profitable swap transactions on Solana DEXs and performs sandwich attacks using ultra-fast execution via a private RPC.
- [Overview](#overview)
- [How It Works](#how-it-works)
- [Features](#features)
- [Architecture](#architecture)
- [Tech Stack](#tech-stack)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Security](#security)
- [Disclaimer](#disclaimer)
- [License](#license)
This is a Node.js-based sandwich bot built for the Solana blockchain. It listens to the mempool, detects vulnerable swaps, and front-runs and back-runs them to extract profit. It's optimized for low latency, speed, and stealth using private RPC access.
- Connects to a private Solana RPC with low latency.
- Subscribes to pending transactions via WebSocket or gRPC.
- Filters for vulnerable Jupiter aggregator swap transactions.
- Executes a front-run (buy).
- Waits for the victimโs transaction to confirm.
- Executes a back-run (sell) to take profit.

- โก Real-time mempool listener (gRPC/WebSocket)
- ๐ Custom logic to filter sandwichable swaps
- ๐งฎ Simulation with Jupiter quote API
- ๐ Private key signing and transaction sending
- ๐ PnL and log tracking
- ๐ก Anti-replay and duplicate detection
- ๐ฒ Optional Telegram integration
+----------------------+
| Mempool Listener |
+----------+-----------+
|
+----------v-----------+
| Transaction Filter |
+----------+-----------+
|
+--------------v--------------+
| Front-run Swap Execution |
+--------------+--------------+
|
+----------v-----------+
| Victim TX Monitoring |
+----------+-----------+
|
+----------v-----------+
| Back-run Sell Swap |
+----------------------+
- Node.js (v18+)
@solana/web3.jsdotenv-
axios(for Jupiter API) -
bs58(for key decoding) -
websocketorgrpcclient (for mempool) - Optional:
telegraffor Telegram alerts
git clone https://github.com/cryptoking-max/solana-sandwich-bot
cd solana-sandwich-bot
npm installCreate a .env file in the root directory:
PRIVATE_KEY=your_private_key_base58
RPC_URL=https://your-private-rpc
JUPITER_API=https://quote-api.jup.ag/v6
SLIPPAGE=0.5
MIN_SWAP_AMOUNT=1000
TELEGRAM_BOT_TOKEN=your_token
TELEGRAM_CHAT_ID=your_chat_idMake sure
.envis in your.gitignore.
node index.jsEnable Telegram alerts:
node index.js --notifyDry run mode (no transactions):
node index.js --simulate- Store private keys in
.envand never commit them. - Run your bot on a secure VPS with a firewall.
- Use rate limiting and backoff strategies.
- Monitor your RPC usage to avoid bans.
This project is for educational purposes only. Sandwich bots are controversial and may violate the terms of use of certain platforms. You are responsible for how you use this software.
MIT License โ see [LICENSE](./LICENSE) for full details.