Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

πŸš€ High-performance Rust-based Solana copy trading bot with multi-DEX support (Pump.fun, Raydium), Jito MEV protection, and real-time WebSocket monitoring. Automatically replicates trades with configurable slippage and priority fees.

Notifications You must be signed in to change notification settings

mooncitydev/solana-copytrading-bot

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Solana Copy Trading Bot

A high-performance Rust-based copy trading bot for Solana blockchain that automatically replicates trades from target wallets across multiple DEX platforms including Pump.fun and Raydium.

✨ Features

πŸ”„ Copy Trading

  • Real-time Monitoring: Monitors target wallets via WebSocket connections
  • Automatic Execution: Instantly replicates buy/sell transactions
  • Multi-DEX Support: Works with Pump.fun and Raydium DEX
  • Slippage Protection: Configurable slippage tolerance

⚑ Performance Optimizations

  • Jito Integration: Uses Jito bundles for MEV protection and faster execution
  • Priority Fees: Configurable compute unit pricing for transaction prioritization
  • Async Architecture: Built with Tokio for high-performance async operations

πŸ›‘οΈ Security & Reliability

  • Private Key Management: Secure wallet key handling
  • Transaction Simulation: Pre-flight transaction validation
  • Error Handling: Comprehensive error handling and logging
  • Bundle Confirmation: Waits for bundle confirmation with timeout

πŸ“Š Trading Features

  • Buy/Sell Operations: Support for both buy and sell transactions
  • Token Management: Automatic ATA (Associated Token Account) creation
  • Pool Detection: Automatic pool discovery via RPC and API
  • Bonding Curve Support: Full Pump.fun bonding curve integration

πŸ—οΈ Architecture

src/
β”œβ”€β”€ common/          # Shared utilities and configurations
β”‚   β”œβ”€β”€ logger.rs    # Logging system
β”‚   └── utils.rs     # Common utilities and AppState
β”œβ”€β”€ core/            # Core trading functionality
β”‚   β”œβ”€β”€ token.rs     # Token operations and ATA management
β”‚   └── tx.rs        # Transaction building and execution
β”œβ”€β”€ dex/             # DEX-specific implementations
β”‚   β”œβ”€β”€ pump_fun.rs  # Pump.fun integration
β”‚   └── raydium.rs   # Raydium AMM integration
β”œβ”€β”€ engine/          # Trading engine
β”‚   └── swap.rs      # Swap execution logic
└── services/        # External services
    └── jito.rs      # Jito bundle service

πŸš€ Quick Start

Prerequisites

  • Rust (latest stable version)
  • Solana CLI tools
  • RPC Endpoint (HTTPS and WSS)
  • Private Key for trading wallet

Installation

  1. Clone the repository

    git clone https://github.com/mooncitydev/solana-copytrading-bot.git
    cd solana-copytrading-bot
  2. Install dependencies

    cargo build --release
  3. Configure environment variables

    # Required environment variables
    export RPC_HTTPS="https://your-rpc-endpoint.com"
    export RPC_WSS="wss://your-wss-endpoint.com"
    export PRIVATE_KEY="your_base58_private_key"
    
    # Optional configuration
    export UNIT_PRICE="1"           # Compute unit price
    export UNIT_LIMIT="300000"      # Compute unit limit
    export HTTP_PROXY="http://proxy:port"  # HTTP proxy (optional)
    export LOG="debug"              # Log level
  4. Run the bot

    cargo run --release

βš™οΈ Configuration

Environment Variables

Variable Required Description Default
RPC_HTTPS βœ… Solana RPC HTTPS endpoint -
RPC_WSS βœ… Solana WebSocket endpoint -
PRIVATE_KEY βœ… Base58 encoded private key -
UNIT_PRICE ❌ Compute unit price for priority fees 1
UNIT_LIMIT ❌ Compute unit limit 300000
HTTP_PROXY ❌ HTTP proxy URL -
LOG ❌ Log level (debug/info/error) info

Swap Configuration

The bot supports configurable swap parameters:

pub struct SwapConfig {
    pub slippage: u64,        // Slippage in basis points
    pub swap_direction: SwapDirection,  // Buy or Sell
    pub use_jito: bool,       // Enable Jito bundles
}

πŸ”§ Usage

Basic Copy Trading

The bot automatically:

  1. Monitors target wallets via WebSocket
  2. Detects new transactions
  3. Analyzes transaction details
  4. Executes matching trades on your wallet
  5. Confirms transaction success

Supported DEX Platforms

🎯 Pump.fun

  • Bonding curve trading
  • Virtual SOL/token reserves
  • Automatic pool completion detection
  • PDA (Program Derived Address) management

πŸ”„ Raydium

  • AMM pool trading
  • Market order support
  • Pool state management
  • API integration for pool discovery

πŸ“ˆ Performance Tips

Optimize for Speed

  • Use Jito bundles for MEV protection
  • Set appropriate priority fees
  • Use fast RPC endpoints
  • Enable WebSocket for real-time updates

Risk Management

  • Set reasonable slippage tolerance
  • Monitor gas costs
  • Use test wallets for initial testing
  • Implement position sizing

πŸ› οΈ Development

Building from Source

# Debug build
cargo build

# Release build (optimized)
cargo build --release

# Run tests
cargo test

# Check code
cargo check

Adding New DEX Support

  1. Create new module in src/dex/
  2. Implement swap interface
  3. Add to DEX router
  4. Update configuration

πŸ“ Logging

The bot includes comprehensive logging:

let logger = Logger::new("[SWAP] => ".to_string());
logger.log("Transaction executed successfully".to_string());
logger.debug("Debug information".to_string());
logger.error("Error occurred".to_string());

⚠️ Disclaimer

IMPORTANT: This software is for educational purposes only. Trading cryptocurrencies involves substantial risk of loss. The authors are not responsible for any financial losses. Use at your own risk.

🀝 Support & Contact

For support, questions, or collaboration:

πŸ“± Telegram: @moooncity

Feel free to reach out for:

  • Technical support
  • Feature requests
  • Bug reports
  • Collaboration opportunities

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Solana Foundation for the excellent blockchain infrastructure
  • Jito Labs for MEV protection solutions
  • Raydium for AMM implementation
  • Pump.fun for innovative bonding curve mechanics

Happy Trading! πŸš€

Remember: Always trade responsibly and never invest more than you can afford to lose.

About

πŸš€ High-performance Rust-based Solana copy trading bot with multi-DEX support (Pump.fun, Raydium), Jito MEV protection, and real-time WebSocket monitoring. Automatically replicates trades with configurable slippage and priority fees.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.