Home - cryptoking-max/solana-sandwich-bot GitHub Wiki
๐ฅช Solana Sandwich Bot (Node.js) Wiki
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.
๐ Table of Contents
- [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)
๐ง Overview
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.
โ๏ธ How It Works
- 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.
๐ Features
- โก 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
๐งฑ Architecture
+----------------------+
| Mempool Listener |
+----------+-----------+
|
+----------v-----------+
| Transaction Filter |
+----------+-----------+
|
+--------------v--------------+
| Front-run Swap Execution |
+--------------+--------------+
|
+----------v-----------+
| Victim TX Monitoring |
+----------+-----------+
|
+----------v-----------+
| Back-run Sell Swap |
+----------------------+
๐ Tech Stack
- Node.js (v18+)
@solana/web3.js
dotenv
axios
(for Jupiter API)bs58
(for key decoding)websocket
orgrpc
client (for mempool)- Optional:
telegraf
for Telegram alerts
๐ฆ Installation
git clone https://github.com/cryptoking-max/solana-sandwich-bot
cd solana-sandwich-bot
npm install
โ๏ธ Configuration
Create 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_id
Make sure
.env
is in your.gitignore
.
๐งช Usage
node index.js
Enable Telegram alerts:
node index.js --notify
Dry run mode (no transactions):
node index.js --simulate
๐ Security
- Store private keys in
.env
and 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.
โ ๏ธ Disclaimer
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.
๐ License
MIT License โ see [LICENSE](./LICENSE) for full details.