https://github.com/casatrick/solana-pumpfun-sniper
jito shredstream pumpfun sniper bot, dev buy filter, same block sniping, parse mint transaction, the lowest latency, avoid multiple rpc call pumpfun sniper bot-solana pumpfun sniper bot
https://github.com/casatrick/solana-pumpfun-sniper
bot pumpfun-sniper rust solana
Last synced: 6 days ago
JSON representation
jito shredstream pumpfun sniper bot, dev buy filter, same block sniping, parse mint transaction, the lowest latency, avoid multiple rpc call pumpfun sniper bot-solana pumpfun sniper bot
- Host: GitHub
- URL: https://github.com/casatrick/solana-pumpfun-sniper
- Owner: casatrick
- Created: 2025-09-17T08:43:37.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-02-19T07:34:21.000Z (4 months ago)
- Last Synced: 2026-06-19T07:36:51.136Z (7 days ago)
- Topics: bot, pumpfun-sniper, rust, solana
- Language: Rust
- Homepage:
- Size: 68.4 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Solana PumpFun Sniper Bot
A high-performance Rust implementation of a Solana PumpFun sniper bot that monitors new token mints and automatically purchases tokens that meet specific market cap criteria.
updated including Mayhem Mode Detect
## Updates for Cashback
- Bonding Curve Sell instruction
```
.remainingAccounts([
{
pubkey: userVolumeAccumulator, // Index 0
isSigner: false,
isWritable: true, // Must be true
},
])
```
- Added hasCashback in Account
```
bondingCurve.isCashbackCoin // New boolean field
```
- Added [true] in createV2
## Features
### Core Features
- **Real-time monitoring** of PumpFun token mints via Geyser gRPC
- **Automatic buy** of new tokens above a market cap threshold
- **Low-latency**: Uses async/await and pre-fetched data for sub-100ms execution
- **Type-safe**: Built with Rust's type system for reliability
- **Configurable** via environment variables
- **Comprehensive error handling** with detailed logging
### Advanced Features (2024)
- **Same-block execution** for near-instantaneous trade execution
- **Jito integration** for ultra-fast transaction processing with MEV protection
- **Multiple gRPC connections** for redundancy and reliability
- **AI-powered scam detection** to avoid honeypots and rug pulls
- **Advanced risk management** with stop-loss and take-profit
- **Intelligent copy trading** to mirror successful traders
- **Updated bonding curve calculations** for accurate pricing
- **Real-time market analysis** with ML-based predictions
### Season 2 Features (December 2024)
- **Instant Migration Detection** for PumpFun Season 2 instant migrations
- **PumpSwap Integration** monitoring for migrated tokens
- **Creator Revenue Tracking** for Season 2 revenue sharing
- **Zero Migration Fees** support for new migration system
- **Enhanced Liquidity Monitoring** for improved trading conditions
## Requirements
- **Rust 1.70+**: Latest stable Rust toolchain
- **Access to a Solana Geyser gRPC endpoint**: For real-time transaction monitoring
- **Helius or other Solana RPC endpoint**: For sending transactions
- **Solana wallet private key**: Base58 string format
## Environment Variables
### Core Configuration
| Variable | Description |
|------------------------|------------------------------------------------------------------|
| `BUYER_PRIVATE_KEY_PATH`| Your Solana wallet private key (base58 string, not a file path) |
| `GRPC_ENDPOINT` | Geyser gRPC endpoint URL |
| `GRPC_AUTH_TOKEN` | Authentication token for the gRPC endpoint |
| `SOLANA_RPC_ENDPOINT` | (Optional) Custom Solana RPC endpoint URL |
| `HELIUS_API_KEY` | (Optional) Helius API key (used if `SOLANA_RPC_ENDPOINT` is unset)|
| `MARKET_CAP_THRESHOLD_USD` | (Optional) Minimum market cap threshold in USD (default: 8000.0) |
| `BUY_AMOUNT_SOL` | (Optional) Amount of SOL to spend per buy (default: 0.001) |
### Advanced Features Configuration
| Variable | Description |
|------------------------|------------------------------------------------------------------|
| `ENABLE_JITO` | Enable Jito for ultra-fast transactions (default: true) |
| `ENABLE_COPY_TRADING` | Enable copy trading functionality (default: false) |
| `ENABLE_SCAM_DETECTION`| Enable AI-powered scam detection (default: true) |
| `ENABLE_SAME_BLOCK_EXECUTION` | Enable same-block execution (default: true) |
| `ENABLE_RISK_MANAGEMENT` | Enable advanced risk management (default: true) |
| `MAX_SLIPPAGE_PERCENTAGE` | Maximum slippage tolerance (default: 20.0) |
| `STOP_LOSS_PERCENTAGE` | Stop-loss percentage (default: 10.0) |
| `TAKE_PROFIT_PERCENTAGE` | Take-profit percentage (default: 50.0) |
| `COPY_TRADING_PERCENTAGE` | Percentage of trader's position to copy (default: 10.0) |
| `JITO_TIP_LAMPORTS` | Jito tip amount in lamports (default: 10000) |
### Season 2 Features Configuration
| Variable | Description |
|------------------------|------------------------------------------------------------------|
| `ENABLE_MIGRATION_DETECTION` | Enable instant migration detection (default: true) |
| `ENABLE_PUMP_SWAP_MONITORING` | Enable PumpSwap monitoring (default: true) |
| `ENABLE_CREATOR_REVENUE_TRACKING` | Enable creator revenue tracking (default: true) |
| `MIGRATION_THRESHOLD` | Migration detection threshold (default: 0.95) |
## Setup & Build
1. **Clone the repository**
```sh
git clone
cd solana-pumpfun-sniper-bot
```
2. **Install Rust** (if not already installed)
```sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
3. **Build the project**
```sh
cargo build --release
```
4. **Set up environment variables**
```sh
cp env.example .env
# Edit .env with your actual values
```
5. **Add Solana Geyser proto file** (required for gRPC)
```sh
mkdir -p proto
# Download the Solana Geyser proto file
curl -o proto/geyser.proto https://raw.githubusercontent.com/solana-labs/solana/master/geyser-plugin-interface/proto/geyser.proto
```
## Usage
1. **Set environment variables** (example for PowerShell):
```powershell
$env:BUYER_PRIVATE_KEY_PATH = ""
$env:GRPC_ENDPOINT = ""
$env:GRPC_AUTH_TOKEN = ""
$env:HELIUS_API_KEY = ""
```
2. **Run the bot**
```sh
cargo run --release
```
## How it Works
- Subscribes to the PumpFun program on Solana via Geyser gRPC
- Monitors for new token mints using transaction discriminators
- Calculates the market cap using the initial SOL deposit and current SOL price
- If the market cap is above the threshold (default: $8,000), sends a buy transaction
- Uses pre-fetched blockhash and cached SOL price for low-latency execution
## Architecture
### Core Components
- **`main.rs`**: Application entry point
- **`sniper.rs`**: Main sniper bot logic and transaction processing
- **`config.rs`**: Configuration management and validation
- **`price_cache.rs`**: SOL price fetching and caching
- **`error.rs`**: Custom error types and handling
- **`constants.rs`**: Application constants and known program IDs
### Advanced Components (2024 Updates)
- **`risk_management.rs`**: Advanced risk assessment and portfolio management
- **`copy_trading.rs`**: Intelligent copy trading engine with trader analysis
- **`jito_integration.rs`**: Jito MEV protection and ultra-fast transactions
- **`grpc_manager.rs`**: Multiple gRPC connection management with failover
- **`scam_detection.rs`**: AI-powered scam and honeypot detection
- **`bonding_curve.rs`**: Advanced bonding curve calculations and simulations
- **`same_block_execution.rs`**: Same-block execution for maximum speed
## Configuration
- **Market cap threshold**: Set `MARKET_CAP_THRESHOLD_USD` environment variable
- **Buy amount**: Set `BUY_AMOUNT_SOL` environment variable
- **Logging**: Uses `tracing` for structured logging
## Security
- **Never share your private key.** Use a dedicated wallet for sniping.
- **Review the code** before running with real funds.
- **Use environment variables** for sensitive configuration.
## Performance
The Rust implementation offers several performance advantages:
- **Zero-cost abstractions**: Rust's abstractions compile to efficient code
- **Memory safety without garbage collection**: No GC pauses
- **Efficient async runtime**: Tokio provides high-performance async I/O
- **Compile-time optimizations**: Rust compiler optimizes aggressively
## Documentation
### Quick Start
- **[QUICKSTART.md](QUICKSTART.md)** - Get running in 5 minutes!
### Comprehensive Guides
- **[README_RUST.md](README_RUST.md)** - Detailed Rust implementation guide
- **[DOC_UPDATED.md](DOC_UPDATED.md)** - Complete documentation
- **[CHANGELOG.md](CHANGELOG.md)** - Version history and updates
### Key Topics
- **Architecture Overview**: System design and data flow
- **Advanced Features**: Same-block execution, Jito, AI detection
- **Configuration Guide**: Environment variables and settings
- **API Reference**: Complete function documentation
- **Troubleshooting**: Common issues and solutions
- **Best Practices**: Recommended usage patterns
## 🛠️ Development
### Building
```sh
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run tests
cargo test
# Check code
cargo check
# Format code
cargo fmt
# Lint code
cargo clippy
```
### Adding Features
The modular architecture makes it easy to extend:
- Add new filters in `sniper.rs`
- Modify configuration in `config.rs`
- Add new error types in `error.rs`
- Extend price sources in `price_cache.rs`
## Troubleshooting
- **Build errors**: Ensure you have the latest Rust toolchain
- **gRPC connection issues**: Check your `GRPC_ENDPOINT` and `GRPC_AUTH_TOKEN`
- **No buys happening**: Confirm the bot is receiving transactions and market cap logic is correct
- **Performance issues**: Use release builds (`cargo run --release`)
## License
MIT
---
*Last Updated: December 2024*
*Version: 2.0.0*