🧊 Raydium Token Pool Bot on Solana
This project allows you to programmatically:
Create a Raydium liquidity pool between SOL and your custom SPL token.
Freeze the token account after creation.
Thaw, buy/sell via Raydium swap, and re-freeze the token.
Add liquidity to the pool.
📦 Project Structure
├── main.ts # Main entry point to create pool ├── src/ | |──json/ | | |── mint.json | | |── pool.json │ ├──constant/ constant.ts # Constants for mint, pool, amounts │ ├── initSdk.ts # Initializes SDK and wallet │ ├── createPool.ts # Creates pool with freeze logic │ ├── addLiquidity.ts # Adds SOL/token to pool │ ├── ThawAndBuy.ts # Thaws token account, buys SOL, re-freezes │ ├── ThawAndSell.ts # Thaws token account, sells SOL, re-freezes ├── wallet.json # Your wallet private key (base58 encoded) ├── package.json
⚙️ Requirements Node.js ≥ 18
ts-node for TypeScript execution
A funded Solana Devnet wallet (SOL + tokens)
🛠️ Setup
-
Install Dependencies
npm install
-
Prepare Your Wallet
Create a wallet.json file:
{ "PRIVATE_KEY": "" }
You can export your Phantom private key using tools like solana-keygen or browser devtools. Be cautious—do not share this file publicly.
🚀 Available Scripts
Script Description
npm run dev ==> Create the Raydium market and liquidity pool
npm run buy ==> Thaw → Buy SOL with your token → Freeze
npm run sell ==> Thaw → Sell SOL for your token → Freeze
npm run thaw ==> Thaw your token account
npm run freeze ==> Freeze your token account
npm run add ==> Add liquidity (SOL and tokens) to the pool
📌 How It Works===============================================================================================================================
🏗️ Pool Creation Uses Raydium SDK v2 and OpenBook DEX
Freezes your token account after pool creation(new SPL token/SOL)
Custom compute units injected for higher success
--> npm run dev
➕ Add Liquidity Automatically calculates how much token to pair with given SOL
Uses computePairAmount from Raydium SDK
--> npm run add
💸 Buy with Token Thaws your wallet’s token account
Swaps tokens for SOL using Raydium
Re-freezes token account
--> npm run buy
💰 Sell for Token Thaws your wallet’s token account
Swaps SOL for token using Raydium
Re-freezes token account
--> npm run sell
🔐 Security Warning Never commit your private key to GitHub
This project interacts with funds—use on Devnet for safety
To use on Mainnet: update DEVNET to "mainnet-beta" and ensure TOKEN_MINT_ADDRESS is a valid mainnet mint
🔐 Thaw token account npm run thaw
🔍 Transaction Explorers
You can inspect transactions at:
https://explorer.solana.com/tx/<txId>?cluster=devnetf (case devnet)
✅ Dependencies Used @raydium-io/raydium-sdk-v2
@solana/web3.js
@solana/spl-token
ts-node, decimal.js, bs58
👨💻 Developer Notes All scripts use Versioned Transactions (v0) with Address Lookup Tables
ComputeBudgetProgram is used to avoid compute unit limit exceeded errors
Raydium pools must have a valid token pair with sufficient decimals
📄 License MIT – Free for educational and research use.
🤝 Acknowledgments
Solana
Raydium Protocol
OpenBook DEX
****** Discription *****
First: npm run dev (You must do this) second: npm run buy/sell ... ...