A collection of Rust examples, SDKs, and tools for building high-performance Solana trading bots. Includes trading examples, SDKs for DEX integration, transaction parsing, key management, and real-time streaming.
δΈζ | English | Website | Telegram | Discord
- β¨ Features
- π Project Structure
- π οΈ Examples
- π¦ SDKs & Tools
- π Quick Start
- π License
- π¬ Contact
- Trading Examples: Ready-to-use trading bot examples for PumpSwap with automated buy/sell strategies
- Multiple SWQoS Support: Concurrent transaction submission via multiple MEV protection services
- Comprehensive SDKs: Modular SDKs for trading, parsing, key management, and streaming
- Real-time Streaming: gRPC-based transaction streaming and parsing with low-latency event processing
- Secure Key Management: Encrypted keystore support with password protection
- Production Ready: Optimized builds with cross-platform support (Linux, macOS)
fnzero-examples/
βββ pumpswap_trade/ # PumpSwap trading example (direct private key)
βββ pumpswap_trade_with_safekey/ # PumpSwap trading example (encrypted keystore)
βββ sol-trade-sdk/ # Unified DEX trading SDK
βββ sol-parser-sdk/ # Transaction parsing SDK (gRPC streaming)
βββ sol-safekey/ # Encrypted key management library
βββ solana-streamer/ # Solana transaction streaming utilities
| Example | Description | Run Command | Source Code |
|---|---|---|---|
| PumpSwap Trading | Automated buyβwaitβsell loop trading on PumpSwap with configurable rounds and rest intervals | ./run.sh |
pumpswap_trade |
| PumpSwap Trading (Encrypted) | Same as above, but uses encrypted keystore file with password protection | ./run.sh |
pumpswap_trade_with_safekey |
Both trading examples include:
- β Automated Trading Loop: Buy β wait 30s β sell β wait 30s, repeat for 3 rounds (configurable)
- β Multiple SWQoS: Concurrent transaction submission via multiple MEV protection services
- β Flexible Configuration: YAML-based config for dev/prod environments
- β Durable Nonce Support: Transaction replay protection for multi-SWQoS scenarios
- β Gas Fee Strategy: Configurable priority fees and compute unit prices
- β Slippage Protection: Customizable slippage settings for buy/sell
- β
Environment Variables: Override config via
.envfile - β Cross-platform Builds: Linux and macOS support with optimized release profiles
Each example supports:
- Environment Variables:
.envfile for sensitive configuration - YAML Config:
config/dev/solana.yamlandconfig/prod/solana.yaml - Example Templates:
.yaml.examplefiles as configuration templates
| Service | Transport Protocols |
|---|---|
| Astralane | HTTP, QUIC β‘ |
| BlockRazor | HTTP, gRPC |
| Bloxroute | HTTP |
| FlashBlock | HTTP |
| Jito | HTTP |
| NextBlock | HTTP |
| Node1 | HTTP, QUIC β‘ |
| Soyas | QUIC β‘ |
| Speedlanding | QUIC β‘ |
| Stellium | HTTP |
| Temporal | HTTP |
| ZeroSlot | HTTP |
| Default | RPC |
API Key Application: Apply for API keys through the official website: https://fnzero.dev/swqos
Note: β‘ = QUIC (Quick UDP Internet Connections) provides lower latency compared to HTTP/gRPC. Services using QUIC (Astralane, Node1, Soyas, Speedlanding) typically offer the best transaction submission performance.
Comprehensive Rust SDK for Solana DEX trading with unified interface for multiple protocols.
Features:
- Support for PumpFun, PumpSwap, Bonk, Raydium CPMM, Raydium AMM V4, Meteora DAMM V2
- Multiple MEV protection services (Jito, BlockRazor, Astralane, etc.)
- Middleware system for custom instruction modification
- Shared infrastructure for multi-wallet scenarios
- Address Lookup Table (ALT) support
- Durable Nonce management
- Gas fee strategy optimization
Documentation: sol-trade-sdk/README.md
Transaction parsing SDK with gRPC streaming support for real-time event processing.
Features:
- Parse PumpFun, PumpSwap, Raydium, and other DEX transactions
- gRPC-based streaming for low-latency event processing
- Event filtering and transformation
- Trade event extraction
- Account filler for optimized account lookups
Documentation: sol-parser-sdk/README.md
Encrypted key management library for secure Solana keypair storage.
Features:
- Encrypt/decrypt Solana keypairs with password protection
- JSON-based keystore format
- Base58 private key support
- CLI tools for key management
- Integration with trading examples
Documentation: sol-safekey/README.md
Utilities for Solana transaction streaming and real-time data processing.
Features:
- Shred stream subscription
- Transaction streaming
- Event processing pipeline
- Performance-optimized parsing
Documentation: solana-streamer/README.md
- Rust 1.70+ and Cargo
- Solana CLI (optional, for wallet management)
- A Solana RPC endpoint (mainnet-beta or devnet)
git clone https://github.com/0xfnzero/fnzero-examples.git
cd fnzero-examplesOption 1: Using direct private key
cd pumpswap_trade
# Configure your settings
cp .env.example .env
# Edit .env with your private key and RPC URL
# Configure SWQoS services
cp config/dev/solana.yaml.example config/dev/solana.yaml
# Edit config/dev/solana.yaml with your API tokens
# Run trading bot
cargo run --release -- <TOKEN_MINT_ADDRESS>Option 2: Using encrypted keystore
cd pumpswap_trade_with_safekey
# Generate encrypted keystore
cargo run --bin sol-safekey -- export <your_private_key_or_mnemonic> ./keystore.json
# Configure settings
cp .env.example .env
cp config/dev/solana.yaml.example config/dev/solana.yaml
# Run trading bot (will prompt for password)
cargo run --release -- <TOKEN_MINT_ADDRESS># Environment: dev or prod
APP_ENV=dev
# Token mint address to trade
MINT=your_token_mint_address
# Sol amount to buy (SOL)
BUY_SOL_AMOUNT=0.01
# RPC URL
SOLANA_RPC_URL=https://your-rpc-endpoint.com
# Keystore password (for encrypted key)
KEYSTORE_PASSWORD=your_password
# Durable nonce account (required for multiple SWQoS)
NONCE_ACCOUNT=your_nonce_account_addressswqos:
region: "Frankfurt" # or NewYork, Tokyo, etc.
enabled_providers:
- provider: "Astralane"
api_token: "your_token"
enabled: true
- provider: "BlockRazor"
api_token: "your_token"
enabled: true
# Add more providers as needed# Optimized release build
cargo build --release
# Cross-compile for Linux (from macOS)
cargo build --release --target x86_64-unknown-linux-gnu
# Run compiled binary
./target/release/pumpswap_trade_with_safekey <TOKEN_MINT_ADDRESS>MIT License
See LICENSE for details.
- Official Website: https://fnzero.dev/
- Project Repository: https://github.com/0xfnzero/fnzero-examples
- Telegram Group: https://t.me/fnzero_group
- Discord Server: https://discord.gg/vuazbGkqQE
- Security: Never commit private keys or API tokens to version control
- Testing: Thoroughly test on devnet before using on mainnet
- Risk: Trading cryptocurrencies involves significant risk
- Compliance: Ensure compliance with local laws and regulations
- RPC Limits: Monitor RPC usage to avoid rate limiting
- MEV Services: Configure API tokens properly for MEV protection services
Contributions are welcome! Please feel free to submit a Pull Request.