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

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

  1. Connects to a private Solana RPC with low latency.
  2. Subscribes to pending transactions via WebSocket or gRPC.
  3. Filters for vulnerable Jupiter aggregator swap transactions.
  4. Executes a front-run (buy).
  5. Waits for the victimโ€™s transaction to confirm.
  6. Executes a back-run (sell) to take profit.

image_1_-king-_me image_2_-king-_me


๐Ÿš€ 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 or grpc 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.