Skip to content

metaggdev/gRPC-Raydium-Sniper-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raydium CPMM Sniper Bot — gRPC Sniper Bot for Solana

A Raydium sniper bot that uses gRPC (Yellowstone) to detect new CPMM (Concentrated Liquidity Market Maker) pools on Raydium and execute buys at pool creation. Built for Solana with a Telegram interface. Suitable for CPMM sniper bot and CLMM sniper bot use cases.


Features

  • gRPC sniper bot — Subscribes to Solana via Yellowstone gRPC for low-latency new-pool detection (no polling).
  • Raydium CPMM — Listens for Raydium CPMM initialize-style transactions and snipes the new pool’s token.
  • Telegram bot — Wallet connection, buy flow, and notifications via Telegraf.
  • PostgreSQL — User and wallet storage for the Telegram bot.

Project Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                           gRPC Raydium Sniper Bot                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌──────────────┐     ┌──────────────────────────────────────────────────┐  │
│  │   Telegram   │     │                  Sniper Core                      │  │
│  │     Bot      │────▶│  • Telegraf (commands, callbacks, messages)      │  │
│  │  (Telegraf)  │     │  • Session state (wallet, buy token, amount)      │  │
│  └──────┬───────┘     │  • handleMessage / callbackquerys / commands     │  │
│         │             └───────────────────────────┬──────────────────────┘  │
│         │                                         │                          │
│         ▼                                         ▼                          │
│  ┌──────────────┐     ┌──────────────────────────────────────────────────┐  │
│  │  PostgreSQL  │     │  sniper/cpmm_new_pool                             │  │
│  │  (users, pk) │     │  • Yellowstone gRPC client (subscribe txns)      │  │
│  └──────────────┘     │  • Filter: CPMM program id (Raydium CPMM)         │  │
│                       │  • Decode tx → extract pool state, open time      │  │
│                       │  • Wait for open time → build & send swap ix      │  │
│                       │  • Wrapping (SOL → WSOL), swap (CPMM), executor    │  │
│                       └───────────────────────────┬──────────────────────┘  │
│                                                   │                          │
│         ┌─────────────────────────────────────────┼──────────────────────┐   │
│         ▼                                         ▼                      ▼   │
│  ┌──────────────┐     ┌──────────────────┐     ┌──────────────────────┐   │
│  │  Solana RPC  │     │  Yellowstone      │     │  Raydium CPMM        │   │
│  │  (config)    │     │  gRPC endpoint    │     │  (swap instructions)  │   │
│  └──────────────┘     └──────────────────┘     └──────────────────────┘   │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

Main components

Layer Path Role
Entry src/bot.ts Telegraf bot, session, command/callback/message wiring
Commands src/commands/start.ts /start — login or home with wallet
Callbacks src/callbackquerys/ BUY, SETTINGS, wallet connect, disconnect, etc.
Messages src/handleMessage/index.ts Wallet PK, token address, amount; triggers sniper
Sniper src/sniper/cpmm_new_pool/ gRPC subscribe → parse new CPMM pool → swap
Config src/config/index.ts BOT_TOKEN, Postgres, RPC_ENDPOINT, GRPC_ENDPOINT, xToken
Data src/sql/query.ts User CRUD (PostgreSQL)
State src/state.ts Session state constants (e.g. WALLET_CONNECTION, BUY_TOKEN_*)

Sniper flow (CPMM new pool)

  1. User sets wallet and triggers buy from Telegram.
  2. Yellowstone gRPC subscription filters transactions by Raydium CPMM program id.
  3. Incoming transaction is decoded; pool info (pool state, token mints, open time) is extracted.
  4. Bot waits until pool open time, then builds a Raydium CPMM swap instruction and submits it (with optional SOL wrap).

Prerequisites

  • Node.js (v18+)
  • PostgreSQL (for Telegram user/wallet storage)
  • Solana RPC endpoint (e.g. Helius, QuickNode, public RPC)
  • Yellowstone gRPC endpoint and xToken (e.g. Triton or similar)
  • Telegram Bot Token from @BotFather

How to Run

1. Clone and install

git clone <your-repo-url>
cd gRPC-Raydium-Sniper-Bot
yarn install
# or: npm install

2. Environment variables

Create a .env in the project root (see .gitignore; never commit it):

# Telegram
BOT_TOKEN=your_telegram_bot_token

# PostgreSQL
POSTGRES_USER=postgres
POSTGRES_HOST=localhost
POSTGRES_DATABASE=your_db
POSTGRES_PWD=your_password
POSTGRES_PORT=5432

# Solana
RPC_ENDPOINT=https://api.mainnet-beta.solana.com
GRPC_ENDPOINT=your_yellowstone_grpc_endpoint
xToken=your_yellowstone_grpc_x_token

Use your own RPC and gRPC endpoints for production.

3. Database

Create the users table (PostgreSQL):

CREATE TABLE users (
  id          SERIAL PRIMARY KEY,
  telegram_id BIGINT UNIQUE NOT NULL,
  pk          TEXT NOT NULL,
  referer     BIGINT
);

4. Build and start

# Build TypeScript
yarn build
# or: npm run build

# Run the bot
yarn start
# or: npm start

For development with auto-reload:

yarn dev
# or: npm run dev

The bot runs as a Telegram bot; open it in Telegram and use BUY (and wallet connection if needed) to trigger the sniper flow.


Scripts

Script Description
yarn build Compile TypeScript to dist/
yarn start Run node dist/bot.js
yarn dev Run with nodemon (src/bot.ts)
yarn test Run sniper tests (nodemon)

Author


Disclaimer

This is experimental software for educational purposes. Use at your own risk. Sniping involves financial risk and reliance on third-party RPC/gRPC and Telegram; the author is not responsible for any losses. Always verify contracts and endpoints yourself.


Keywords (for search)

Raydium sniper bot · CPMM sniper bot · CLMM sniper bot · gRPC sniper bot · Solana sniper · Yellowstone gRPC · Raydium CPMM

About

Raydium CPMM sniper bot using Yellowstone gRPC for low-latency new-pool detection on Solana. Telegram UI, PostgreSQL. Raydium sniper · CPMM sniper · gRPC sniper.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors