Solana Streamer
A lightweight Rust library for real-time event streaming from Solana DEX trading programs. This library provides efficient event parsing and subscription capabilities for PumpFun, PumpSwap, Bonk, and Raydium CPMM protocols.
Project Features
- Real-time Event Streaming: Subscribe to live trading events from multiple Solana DEX protocols
- Yellowstone gRPC Support: High-performance event subscription using Yellowstone gRPC
- ShredStream Support: Alternative event streaming using ShredStream protocol
- Multi-Protocol Support:
- PumpFun: Meme coin trading platform events
- PumpSwap: PumpFun's swap protocol events
- Bonk: Token launch platform events (letsbonk.fun)
- Raydium CPMM: Raydium's Concentrated Pool Market Maker events
- Raydium CLMM: Raydium's Concentrated Liquidity Market Maker events
- Unified Event Interface: Consistent event handling across all supported protocols
- Event Parsing System: Automatic parsing and categorization of protocol-specific events
- High Performance: Optimized for low-latency event processing
Installation
Direct Clone
Clone this project to your project directory:
Add the dependency to your Cargo.toml:
# Add to your Cargo.toml
= { = "./solana-streamer", = "0.1.8" }
Use crates.io
# Add to your Cargo.toml
= "0.1.8"
Usage Examples
use ;
async
async
async
Supported Protocols
- PumpFun: Primary meme coin trading platform
- PumpSwap: PumpFun's swap protocol
- Bonk: Token launch platform (letsbonk.fun)
- Raydium CPMM: Raydium's Concentrated Pool Market Maker protocol
- Raydium CLMM: Raydium's Concentrated Liquidity Market Maker protocol
Event Streaming Services
- Yellowstone gRPC: High-performance Solana event streaming
- ShredStream: Alternative event streaming protocol
Architecture Features
Unified Event Interface
- UnifiedEvent Trait: All protocol events implement a common interface
- Protocol Enum: Easy identification of event sources
- Event Factory: Automatic event parsing and categorization
Event Parsing System
- Protocol-specific Parsers: Dedicated parsers for each supported protocol
- Event Factory: Centralized event creation and parsing
- Extensible Design: Easy to add new protocols and event types
Streaming Infrastructure
- Yellowstone gRPC Client: Optimized for Solana event streaming
- ShredStream Client: Alternative streaming implementation
- Async Processing: Non-blocking event handling
Project Structure
src/
├── common/ # Common functionality and types
├── protos/ # Protocol buffer definitions
├── streaming/ # Event streaming system
│ ├── event_parser/ # Event parsing system
│ │ ├── common/ # Common event parsing tools
│ │ ├── core/ # Core parsing traits and interfaces
│ │ ├── protocols/# Protocol-specific parsers
│ │ │ ├── bonk/ # Bonk event parsing
│ │ │ ├── pumpfun/ # PumpFun event parsing
│ │ │ ├── pumpswap/ # PumpSwap event parsing
│ │ │ ├── raydium_cpmm/ # Raydium CPMM event parsing
│ │ │ └── raydium_clmm/ # Raydium CLMM event parsing
│ │ └── factory.rs # Parser factory
│ ├── shred_stream.rs # ShredStream client
│ ├── yellowstone_grpc.rs # Yellowstone gRPC client
│ └── yellowstone_sub_system.rs # Yellowstone subsystem
├── lib.rs # Main library file
└── main.rs # Example program
Performance Considerations
- Connection Management: Properly handle connection lifecycle and reconnection
- Event Filtering: Use protocol filtering to reduce unnecessary event processing
- Memory Management: Implement proper cleanup for long-running streams
- Error Handling: Robust error handling for network issues and service disruptions
Configuration Options
Yellowstone gRPC Configuration
let grpc = new?;
ShredStream Configuration
let shred_stream = new.await?;
License
MIT License
Contact
- Project Repository: https://github.com/0xfnzero/solana-streamer
- Telegram Group: https://t.me/fnzero_group
Important Notes
- Network Stability: Ensure stable network connection for continuous event streaming
- Rate Limiting: Be aware of rate limits on public gRPC endpoints
- Error Recovery: Implement proper error handling and reconnection logic
- Resource Management: Monitor memory and CPU usage for long-running streams
- Compliance: Ensure compliance with relevant laws and regulations