Skip to content

πŸš€ Solana Arbitrage Bot A high-performance Solana arbitrage bot that automatically detects and executes profitable trading opportunities across different DEX routes using Jupiter aggregator and fast transaction submission methods.

Notifications You must be signed in to change notification settings

mooncitydev/solana-arbitrage-bot-master

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Solana Arbitrage Bot

A high-performance Solana arbitrage bot that automatically detects and executes profitable trading opportunities across different DEX routes using Jupiter aggregator and fast transaction submission methods.

✨ Features

  • Automated Arbitrage Detection: Continuously monitors price differences between trading pairs
  • Jupiter Integration: Uses Jupiter aggregator for optimal swap routes and best execution prices
  • Fast Transaction Submission: Supports multiple fast transaction submission methods:
    • Jito MEV: Bundle transactions for faster processing and MEV protection
    • Solayer: High-speed transaction submission for competitive advantage
  • Smart Route Optimization: Automatically finds the most profitable arbitrage paths
  • Real-time Monitoring: Continuous operation with configurable delays
  • Token Management: Automatic ATA (Associated Token Account) creation and cleanup
  • Slippage Protection: Configurable slippage tolerance for safe trading

πŸ—οΈ Architecture

The bot operates on a continuous loop that:

  1. Monitors price differences between USDC and target tokens
  2. Calculates potential arbitrage opportunities
  3. Executes trades when profit thresholds are met
  4. Uses fast transaction submission for competitive advantage
  5. Manages token accounts efficiently

πŸ“‹ Prerequisites

  • Node.js (v16 or higher)
  • Solana CLI tools
  • A Solana wallet with SOL for transaction fees
  • USDC balance for trading

πŸš€ Installation

  1. Clone the repository

    git clone jupiter-arbitrage-bot-master
    cd jupiter-arbitrage-bot-master
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Set up environment variables Create a .env file in the root directory:

    PRIVATE_KEY=your_wallet_private_key_here
    MAINNET_RPC=your_mainnet_rpc_endpoint_here
    UPPER_AMOUNT_WITH_DECIMAL=1000000

βš™οΈ Configuration

Environment Variables

  • PRIVATE_KEY: Your Solana wallet private key (required)
  • MAINNET_RPC: Mainnet RPC endpoint (required)
  • UPPER_AMOUNT_WITH_DECIMAL: Minimum profit threshold in lamports (default: 0)

Trading Parameters

The bot is currently configured to trade between:

  • Base Token: USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)
  • Target Token: USDT (Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB)
  • Trade Amount: 5 USDC per trade (5,000,000 lamports)
  • Delay: 500ms between trades

🎯 Usage

Development Mode

npm run dev
# or
yarn dev

Production Mode

npm start
# or
yarn start

πŸ”§ Customization

Changing Trading Pairs

Edit src/index.ts to modify the trading pairs:

// Change the target token mint address
await getRoute(STABLE_COIN.usdc, "NEW_TOKEN_MINT_ADDRESS", 5_000_000);

Adjusting Trade Amounts

Modify the amount parameter in the getRoute call:

// Change from 5 USDC to 10 USDC
await getRoute(STABLE_COIN.usdc, "TOKEN_MINT", 10_000_000);

Modifying Delay

Adjust the sleep duration in the main loop:

await sleep(1000); // Change to 1 second delay

πŸ›‘οΈ Safety Features

  • Slippage Protection: Configurable slippage tolerance
  • Profit Thresholds: Minimum profit requirements before execution
  • Error Handling: Graceful error handling with logging
  • Account Management: Automatic cleanup of temporary token accounts

πŸ“Š Supported Networks

  • Mainnet: Full production support
  • Devnet: For testing (requires configuration changes)

πŸ”— Dependencies

  • @coral-xyz/anchor: Solana program interaction
  • @solana/web3.js: Solana blockchain interaction
  • @solana/spl-token: Token program utilities
  • undici: HTTP client for API calls
  • dotenv: Environment variable management

πŸ“ Project Structure

src/
β”œβ”€β”€ config/           # Configuration files
β”œβ”€β”€ constant/         # Constants and addresses
β”œβ”€β”€ fast-landing-api/ # Fast transaction submission
β”œβ”€β”€ module/           # Core bot modules
β”œβ”€β”€ types/            # TypeScript type definitions
β”œβ”€β”€ utils/            # Utility functions
└── index.ts          # Main bot entry point

⚠️ Important Notes

  • Private Key Security: Never commit your private key to version control
  • Risk Management: This bot involves real money trading - use at your own risk
  • Testing: Always test on devnet before mainnet deployment
  • Monitoring: Keep an eye on the bot's performance and adjust parameters as needed

🚨 Disclaimer

This software is for educational and research purposes. Trading cryptocurrencies involves substantial risk of loss and is not suitable for all investors. The value of cryptocurrencies can go down as well as up, and you may lose some or all of your investment. Past performance is not indicative of future results.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“ž Contact

For questions, support, or collaboration opportunities:

Telegram

Telegram: @moooncity


Made with ❀️ for the Solana ecosystem

About

πŸš€ Solana Arbitrage Bot A high-performance Solana arbitrage bot that automatically detects and executes profitable trading opportunities across different DEX routes using Jupiter aggregator and fast transaction submission methods.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published