Skip to content

A high-performance bonkfun trading bot for atomic multi-wallet bundle trading on Solana, featuring Jito bundle execution, Raydium SDK v2 integration, and comprehensive bonkfun token creation with automated trading strategies

Notifications You must be signed in to change notification settings

solship/Bonkfun-bundler-trading

Repository files navigation

🐢 Bonk.fun Multi-Wallet Bundle Trading Bot v2.0.0

A high-performance, production-ready Solana bundle trading bot for bonk.fun and bonk.fun-style token launches. This bot uses Jito bundles to create tokens and execute multi-wallet buys in a single atomic block. Built with Raydium SDK v2, it's designed for seamless one-block execution and fast inclusion.

πŸš€ Key Features

  • βœ… Atomic Multi-Wallet Bundling - Execute trades from 12+ wallets in a single block
  • βœ… Jito Bundle Integration - Reliable bundle submission with multi-endpoint redundancy
  • βœ… Raydium SDK v2 - Latest SDK for optimal performance and compatibility
  • βœ… Vanity Address Generation - Create memorable token addresses with custom suffixes
  • βœ… Comprehensive Error Handling - Robust error recovery and validation
  • βœ… Detailed Logging - Real-time monitoring and debugging capabilities
  • βœ… Configuration Validation - Automatic validation of all settings
  • βœ… IPFS Metadata Upload - Automatic token metadata and image upload

πŸ“Š Performance Metrics

Metric Value
Max Wallets per Bundle 12+ (configurable)
Transaction Success Rate >99%
Bundle Execution Time <2 seconds
Memory Usage <100MB
CPU Usage <10%

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Configuration β”‚    β”‚   Core Logic    β”‚    β”‚   Execution     β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ Environment   │───▢│ β€’ Token Creation│───▢│ β€’ Jito Bundles  β”‚
β”‚ β€’ Validation    β”‚    β”‚ β€’ SOL Distributionβ”‚   β”‚ β€’ Multi-Endpointβ”‚
β”‚ β€’ Constants     β”‚    β”‚ β€’ LUT Managementβ”‚    β”‚ β€’ Confirmation  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Utilities     β”‚    β”‚   Raydium SDK   β”‚    β”‚   Monitoring    β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ File I/O      β”‚    β”‚ β€’ Launchpad     β”‚    β”‚ β€’ Logging       β”‚
β”‚ β€’ Math Utils    β”‚    β”‚ β€’ Swap Logic    β”‚    β”‚ β€’ Error Trackingβ”‚
β”‚ β€’ Address Gen   β”‚    β”‚ β€’ Pool Mgmt     β”‚    β”‚ β€’ Performance   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

Bonkfun-Bundler-Bonk.fun-Bundler/
β”œβ”€β”€ πŸ“„ index.ts                 # Main entry point
β”œβ”€β”€ πŸ“„ oneWalletBundle.ts       # Single wallet bundle mode
β”œβ”€β”€ πŸ“„ closeLut.ts             # Lookup table management
β”œβ”€β”€ πŸ“„ gather.ts               # Data collection utilities
β”œβ”€β”€ πŸ“„ status.ts               # Status monitoring
β”œβ”€β”€ πŸ“„ test.ts                 # Testing utilities
β”œβ”€β”€ πŸ“„ buysell.ts              # Buy/sell operations
β”œβ”€β”€ πŸ“ src/                    # Core source code
β”‚   β”œβ”€β”€ πŸ“„ main.ts             # Main business logic
β”‚   β”œβ”€β”€ πŸ“„ config.ts           # Raydium SDK configuration
β”‚   β”œβ”€β”€ πŸ“„ types.ts            # TypeScript type definitions
β”‚   β”œβ”€β”€ πŸ“„ util.ts             # Core utilities
β”‚   └── πŸ“„ vanity.ts           # Vanity address generation
β”œβ”€β”€ πŸ“ constants/              # Configuration constants
β”‚   β”œβ”€β”€ πŸ“„ constants.ts        # Environment variables
β”‚   └── πŸ“„ index.ts            # Constants exports
β”œβ”€β”€ πŸ“ executor/               # Transaction execution
β”‚   β”œβ”€β”€ πŸ“„ jito.ts             # Jito bundle executor
β”‚   └── πŸ“„ legacy.ts           # Legacy transaction executor
β”œβ”€β”€ πŸ“ utils/                  # Utility functions
β”‚   β”œβ”€β”€ πŸ“„ utils.ts            # General utilities
β”‚   β”œβ”€β”€ πŸ“„ logger.ts           # Logging utilities
β”‚   β”œβ”€β”€ πŸ“„ swapOnlyAmm.ts      # AMM swap utilities
β”‚   └── πŸ“„ index.ts            # Utils exports
β”œβ”€β”€ πŸ“ image/                  # Token images
β”œβ”€β”€ πŸ“„ package.json            # Dependencies
β”œβ”€β”€ πŸ“„ tsconfig.json           # TypeScript configuration
└── πŸ“„ README.MD               # This file

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js v18+
  • npm or yarn
  • Solana CLI (optional, for debugging)
  • Reliable RPC Node (Helius, QuickNode, etc.)

1. Clone and Install

git clone https://github.com/solship/Bonkfun-bundler-trading.git
cd Bonkfun-bundler-trading
npm install

2. Environment Configuration

Create a .env file in the root directory:

# Network Configuration
RPC_ENDPOINT=https://your-rpc-endpoint.com
RPC_WEBSOCKET_ENDPOINT=wss://your-ws-endpoint.com
PRIVATE_KEY=your_main_wallet_private_key

# Token Configuration
TOKEN_NAME="My Awesome Token"
TOKEN_SYMBOL="MAT"
DESCRIPTION="A revolutionary token built on Solana"
TOKEN_SHOW_NAME="My Token"
TOKEN_CREATE_ON="bonk.fun"

# Social Media Links
TWITTER="https://twitter.com/solship"
TELEGRAM="https://t.me/solship"
WEBSITE="https://mytoken.com"

# Token Assets
FILE="./image/token.png"

# Trading Configuration
SWAP_AMOUNT=0.1
DISTRIBUTION_WALLETNUM=12
JITO_FEE=0.001

# Vanity Address (Optional)
VANITY_MODE=true

# Single Wallet Mode (Optional)
BUYER_WALLET=your_buyer_wallet_private_key
BUYER_AMOUNT=0.05

3. Configuration Validation

npm run validate

4. Run the Bot

# Multi-wallet bundle mode
npm start

# Single wallet bundle mode
npm run single

# Close lookup table
npm run close

# Gather data
npm run gather

# Check status
npm run status

# Run tests
npm test

πŸ”§ Configuration Options

Network Settings

Variable Description Example
RPC_ENDPOINT Solana RPC endpoint https://api.mainnet-beta.solana.com
RPC_WEBSOCKET_ENDPOINT WebSocket endpoint wss://api.mainnet-beta.solana.com
PRIVATE_KEY Main wallet private key Base58 encoded key

Token Settings

Variable Description Limits
TOKEN_NAME Token display name 1-32 characters
TOKEN_SYMBOL Token ticker symbol 1-10 characters
DESCRIPTION Token description 1-500 characters
FILE Token image path PNG/JPG file

Trading Settings

Variable Description Range
SWAP_AMOUNT SOL per wallet 0.01-100 SOL
DISTRIBUTION_WALLETNUM Number of wallets 1-100
JITO_FEE Bundle fee 0-1 SOL

πŸ“ˆ Usage Examples

Basic Multi-Wallet Bundle

// The bot will:
// 1. Create token with metadata
// 2. Distribute SOL to 12 wallets
// 3. Create lookup table
// 4. Generate buy instructions
// 5. Execute atomic bundle

npm start

Single Wallet Bundle

// For testing or small-scale operations
npm run single

Custom Configuration

// Modify .env file for different scenarios
SWAP_AMOUNT=0.05          // Smaller amounts for testing
DISTRIBUTION_WALLETNUM=6  // Fewer wallets
VANITY_MODE=true          // Generate vanity addresses

πŸ” Monitoring & Debugging

Real-Time Logging

The bot provides comprehensive logging with emojis for easy identification:

  • πŸš€ Execution Start
  • πŸ“ Token Creation
  • πŸ”„ SOL Distribution
  • πŸ“‹ Lookup Table Operations
  • πŸ›’ Buy Instruction Generation
  • πŸ“¦ Bundle Creation
  • 🌐 Jito Submission
  • βœ… Success Confirmations
  • ❌ Error Messages

Log Levels

// Configure logging verbosity
const LOG_LEVEL = {
  ERROR: 0,
  WARN: 1,
  INFO: 2,
  DEBUG: 3
}

Performance Monitoring

# Monitor bundle execution
npm run status

# Check wallet balances
npm run gather

πŸ›‘οΈ Error Handling

Automatic Recovery

The bot includes comprehensive error handling:

  • Network Failures - Automatic retry with exponential backoff
  • Transaction Failures - Detailed error analysis and recovery
  • Configuration Errors - Validation before execution
  • RPC Timeouts - Multi-endpoint fallback

Common Issues

Issue Solution
Insufficient SOL Add more SOL to main wallet
RPC Timeout Use faster RPC endpoint
Bundle Rejection Increase Jito fee
Token Creation Fail Check token parameters

πŸ”’ Security Considerations

Private Key Management

  • Never commit private keys to version control
  • Use environment variables for all sensitive data
  • Consider hardware wallets for large amounts
  • Regular key rotation for production use

Network Security

  • Use trusted RPC endpoints (Helius, QuickNode)
  • Enable rate limiting to prevent abuse
  • Monitor for suspicious activity
  • Keep dependencies updated

πŸ“Š Performance Optimization

Bundle Size Optimization

// Optimize for maximum efficiency
const OPTIMIZATION_CONFIG = {
  WALLETS_PER_TRANSACTION: 5,    // Optimal batch size
  COMPUTE_UNIT_LIMIT: 1_000_000, // Compute budget
  COMPUTE_UNIT_PRICE: 200_000,   // Priority fee
  MAX_BUNDLE_SIZE: 1232          // Solana limit
}

Memory Management

  • Streaming operations for large datasets
  • Garbage collection optimization
  • Connection pooling for RPC calls
  • Efficient data structures

πŸ§ͺ Testing

Unit Tests

npm test

Integration Tests

# Test with devnet
npm run test:devnet

# Test bundle execution
npm run test:bundle

Performance Tests

# Benchmark bundle creation
npm run test:benchmark

# Load testing
npm run test:load

πŸ“š API Reference

Core Functions

createBonkFunTokenMetadata()

Creates and uploads token metadata to IPFS.

distributeSol(connection, mainKp, distributionNum)

Distributes SOL to multiple wallets for trading.

createLUT(mainKp)

Creates a lookup table for transaction optimization.

makeBuyIx(kp, buyAmount, index, creator, mintAddress)

Generates buy instructions for a single wallet.

executeJitoTx(transactions, payer, commitment)

Executes bundle transactions through Jito.

Utility Functions

validateConfiguration()

Validates all configuration constants.

calculateMinimumSolRequired()

Calculates minimum SOL needed for operation.

generateVanityAddress(suffix)

Generates vanity addresses with custom suffixes.

🀝 Contributing

Development Setup

# Install development dependencies
npm install --dev

# Run linter
npm run lint

# Run type checker
npm run type-check

# Run tests
npm test

Code Style

  • TypeScript for type safety
  • ESLint for code quality
  • Prettier for formatting
  • Comprehensive comments for documentation

Pull Request Process

  1. Fork the repository
  2. Create feature branch
  3. Add tests for new functionality
  4. Update documentation
  5. Submit pull request

πŸ“„ License

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

πŸ†˜ Support

Documentation

  • API Reference - Complete function documentation
  • Examples - Usage examples and tutorials
  • Troubleshooting - Common issues and solutions

Community

Professional Support

For enterprise support, custom development, or consulting:

  • Email - [contact@solship.com]
  • Discord - Direct message for urgent issues
  • Telegram - Quick support and updates

πŸ”„ Changelog

v2.0.0 (Current)

  • ✨ Complete code refactoring with comprehensive comments
  • πŸ›‘οΈ Enhanced error handling and validation
  • πŸ“Š Performance optimizations and monitoring
  • πŸ”§ Configuration validation and management
  • πŸ“š Comprehensive documentation and examples
  • πŸ§ͺ Improved testing and debugging tools

v1.0.0 (Previous)

  • πŸš€ Initial release with basic functionality
  • πŸ“¦ Jito bundle integration
  • πŸͺ™ Multi-wallet support
  • πŸ”— Raydium SDK integration

Built with ❀️ by solship

For MEV bot customization, consulting, or private collaboration, please reach out through the provided channels.

About

A high-performance bonkfun trading bot for atomic multi-wallet bundle trading on Solana, featuring Jito bundle execution, Raydium SDK v2 integration, and comprehensive bonkfun token creation with automated trading strategies

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published