A high-performance Solana copy-trading bot written in Rust. It watches a target wallet’s on-chain activity and mirrors trades on Raydium and Pump.fun as soon as matching transactions appear.
The bot uses WebSocket transaction streaming (Helius-style transactionSubscribe) for low-latency detection and can submit copies via Jito bundles for faster inclusion.
flowchart LR
A[Target wallet trades] --> B[Solana RPC WebSocket]
B --> C[Bot filters Raydium / Pump.fun txs]
C --> D[Parse direction, mint, amount]
D --> E[Build swap on your wallet]
E --> F[Sign and send via RPC / Jito]
transactionSubscribe (e.g. Helius).| Feature | Description |
|---|---|
| Real-time streaming | WebSocket transactionSubscribe with processed commitment for early detection |
| Multi-DEX | Raydium AMM swaps and Pump.fun buy/sell |
| Target filtering | Monitors a configurable TARGET_PUBKEY |
| Noise reduction | Excludes known aggregator/program accounts (e.g. Jupiter) via accountExclude |
| Jito integration | Optional bundle submission and tip configuration for competitive landing |
| Structured modules | Separate dex, engine, core, and services layers for maintainability |
Target wallet
GXAtmWucJEQxuL8PtpP13atoFi78eM6c9Cuw9fK9W4na
Copy wallet
HqbQwVM2fhdYJXqFhBE68zX6mLqCWqEqdgrtf2ePmjRz
| Role | Transaction |
|---|---|
| Target | View on Solscan |
| Copied | View on Solscan |
link.exe for native dependencies)build-essential, Xcode CLI tools)RPC_ENDPOINT) with good read performanceRPC_WEBSOCKET_ENDPOINT) that supports transactionSubscribe (Helius and similar providers)git clone https://github.com/<your-org>/Copy-trading-bot.git
cd Copy-trading-bot
cp .env.example .env
Edit .env with your RPC URLs, target wallet, slippage, and Jito settings. See Configuration for every variable.
The bot loads the signing keypair from key.txt in the project root (Base58-encoded secret key, one line, no quotes):
your_base58_private_key_here
Never commit
key.txtor.env. Both are ignored by.gitignorefor.env; ensurekey.txtis also kept local-only.
cargo build --release
cargo run --release
On success you should see a startup log line similar to:
--------------------- Copy-trading-bot start!!! ------------------
Copy .env.example to .env and set the values below.
| Variable | Required | Description |
|---|---|---|
RPC_ENDPOINT |
Yes | HTTP Solana RPC URL (e.g. https://mainnet.helius-rpc.com/?api-key=...) |
RPC_WEBSOCKET_ENDPOINT |
Yes | WebSocket URL for transactionSubscribe |
TARGET_PUBKEY |
Yes | Public key of the wallet whose trades you want to copy |
JUP_PUBKEY |
Yes | Account to exclude from the subscription filter (commonly your Jupiter-related pubkey) |
RAY_PUBKEY |
Yes | Raydium-related pubkey used in parsing/filtering |
SOL_PUBKEY |
Yes | Wrapped SOL / native mint reference for routing |
RAY_AUTHORITY_V4 |
Yes | Raydium authority v4 address for swap instruction building |
WSOL_USDC |
Yes | Reference pool or mint pair for WSOL/USDC lookups |
SLIPPAGE |
Yes | Slippage tolerance in basis points (e.g. 100 = 1%) |
JITO_TIP_VALUE |
If using Jito | Tip amount (lamports or configured unit per your setup) |
JITO_BLOCK_ENGINE_URL |
If using Jito | Jito block engine base URL |
JITO_TIP_STREAM_URL |
If using Jito | Jito tip stream URL for dynamic tip hints |
JITO_TIP_PERCENTILE |
Optional | Tip percentile when using tip stream (see services/jito.rs) |
UNIT_PRICE |
Optional | Priority fee unit price (default 1) |
UNIT_LIMIT |
Optional | Compute unit limit (default 300000) |
.envkey.txt (Base58), read by import_wallet() / import_arc_wallet() in src/common/utils.rs.env: RPC endpoints, target wallet, DEX constants, slippage, and Jito — not the private key in the current codebaseFor transactionSubscribe with rich transaction details, a provider such as Helius is typical. Use the HTTP URL for RPC_ENDPOINT and the Geyser/WebSocket URL for RPC_WEBSOCKET_ENDPOINT.
Copy-trading-bot/
├── Cargo.toml # Dependencies (Solana SDK, Raydium, Jito, tokio, etc.)
├── .env.example # Environment template
├── key.txt # Your wallet secret (create locally, do not commit)
├── src/
│ ├── main.rs # WebSocket subscription loop and trade handlers
│ ├── lib.rs # Module exports
│ ├── common/
│ │ └── utils.rs # RPC clients, wallet, logging, AppState
│ ├── core/
│ │ ├── token.rs # SPL token / ATA helpers
│ │ └── tx.rs # Sign, send, Jito bundle confirmation
│ ├── dex/
│ │ ├── pump.rs # Pump.fun program constants and swap logic
│ │ └── raydium.rs # Raydium AMM swap and pool discovery
│ ├── engine/
│ │ └── swap.rs # High-level pump_swap / raydium_swap entry points
│ └── services/
│ └── jito.rs # Jito tip accounts, bundle status, progress UI
└── README.md
The bot subscribes with a JSON-RPC payload similar to:
transactionSubscribeaccountInclude — Raydium AMM program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 and Pump.fun program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6PaccountExclude — value from JUP_PUBKEY to reduce unrelated aggregator trafficprocessedjsonParsed with full transaction detailsIncoming messages are routed to:
tx_ray — Raydium swap detection and swap_to_events_on_raydiumtx_pump — Pump.fun buy/sell detection and swap_to_events_on_pumpTrade size can be scaled (e.g. amount_in * percent / 100) before calling the engine layer.
6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6Psrc/dex/pump.rs, orchestrated by engine::swap::pump_swap675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8get_pool_info)src/dex/raydium.rs, orchestrated by engine::swap::raydium_swapswap_on_jup in main.rs is reserved for Jupiter-based routing when needed.
Runtime messages are appended to src/log.txt with timestamps via log_message() in src/common/utils.rs.
.env and key.txt — Must not be pushed to GitHub or shared in chat.Copy trading on Solana involves substantial financial risk: slippage, failed transactions, MEV, illiquid tokens, and total loss of funds are possible. This software is provided as-is with no guarantee of profitability, correctness, or uptime. Use at your own risk. Nothing here is financial advice.
| Issue | What to try |
|---|---|
link.exe not found (Windows) |
Install Visual Studio Build Tools with C++ workload |
| WebSocket connection fails | Verify RPC_WEBSOCKET_ENDPOINT and provider supports transactionSubscribe |
TARGET_PUBKEY not set |
Ensure .env is in the project root and loaded (dotenv in main.rs) |
Not set Private Key / wallet errors |
Create key.txt with a valid Base58 secret key |
| Trades not copying | Confirm target actually uses Raydium/Pump.fun; check logs in src/log.txt |
| Slow or dropped txs | Enable Jito tips, raise priority fees (UNIT_PRICE / UNIT_LIMIT), use a faster RPC |
| Layer | Technology |
|---|---|
| Language | Rust (2021 edition) |
| Async runtime | Tokio |
| Solana | solana-sdk, solana-client 1.16.x |
| DEX | Raydium AMM (raydium-amm, raydium-library), Pump.fun on-chain program |
| Streaming | tokio-tungstenite WebSocket client |
| Bundles | Jito JSON-RPC block engine client |
| Config | dotenv, environment variables |
For full bot setups, integrations, or custom development:
Telegram: @soulcrancerdev
No. This project is for educational purposes only. Use at your own risk.
Yes. MIT licensed — fork, modify, and contribute via pull requests.
Not financial advice. Trading and software use involves risk. Past performance does not guarantee future results.
Keywords: high-performance Solana copy-trading bot written in Rust, copy-trading, copytrade-bot, solana, solana-bot, trading-bot
$ claude mcp add solana-copytrading-bot \
-- python -m otcore.mcp_server <graph>