Skip to content

High-performance Rust proxy that abstracts Solana DEX complexities into simple APIs, enabling developers to build trading bots in any language without blockchain expertise. Provides sub-millisecond event streaming and transaction execution for PumpFun, PumpSwap, and Meteora DAMM V2

Notifications You must be signed in to change notification settings

0xfnzero/trading-bot-proxy

Repository files navigation

πŸš€ Solana DEX Trading Bot Proxy

High-Performance Solana DEX Automated Trading Proxy System

High-performance Rust proxy that abstracts Solana DEX complexities into simple APIs, enabling developers to build trading bots in any language without blockchain expertise. Provides sub-millisecond event streaming and transaction execution for PumpFun, PumpSwap, and Meteora DAMM V2

License GitHub stars GitHub forks

Rust TypeScript Solana Redis

δΈ­ζ–‡ | English | Website | Telegram | Discord


πŸ“‹ Overview

Trading Bot Proxy is a high-performance middleware that bridges the gap between Solana blockchain complexity and bot strategy development. Built with Rust for maximum performance and minimal latency, it allows developers to focus purely on trading strategy logic without dealing with the intricacies of Solana transaction construction and data stream parsing.

🎯 Why Trading Bot Proxy?

Lower Development Barrier

  • βœ… No Blockchain Expertise Required: Focus on trading strategy, not Solana transaction mechanics
  • βœ… Language Agnostic: Develop your bot in any programming language (Python, JavaScript, Go, etc.)
  • βœ… Pre-built DEX Integration: PumpFun, PumpSwap, Meteora DAMM V2 protocols already integrated
  • βœ… Simplified API: Unix Socket (events) + HTTP API (commands) for easy integration

Rust Performance Benefits

  • ⚑ Ultra-Low Latency: Rust's zero-cost abstractions ensure minimal overhead
  • ⚑ High Throughput: Handle thousands of events per second without breaking a sweat
  • ⚑ Memory Efficient: Rust's memory safety without garbage collection pauses
  • ⚑ Real-time Data Streaming: Sub-millisecond event processing via Unix Socket + Protobuf

What You Don't Need to Worry About

  • ❌ Solana transaction construction and signing
  • ❌ Program instruction encoding/decoding
  • ❌ Account data parsing and deserialization
  • ❌ DEX-specific protocol implementations
  • ❌ WebSocket connection management with RPC nodes
  • ❌ Event stream parsing and filtering

What You Can Focus On

  • βœ… Trading strategy and signal generation
  • βœ… Risk management and position sizing
  • βœ… Portfolio optimization
  • βœ… Market analysis and pattern recognition

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Your Trading Strategy                       β”‚
β”‚              (Python/JavaScript/Go/Any Language)                 β”‚
β”‚                                                                   β”‚
β”‚  β€’ Market Analysis      β€’ Signal Generation                      β”‚
β”‚  β€’ Risk Management      β€’ Position Sizing                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ Unix Socket (Events) + HTTP API (Commands)
                             β”‚ Protobuf Binary Protocol
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Trading Bot Proxy (Rust Server)                     β”‚
β”‚                                                                   β”‚
β”‚  ⚑ High Performance Layer:                                      β”‚
β”‚    β€’ Transaction Construction & Signing                          β”‚
β”‚    β€’ Instruction Encoding/Decoding                               β”‚
β”‚    β€’ Real-time Event Stream Processing (Unix Socket)            β”‚
β”‚    β€’ DEX Protocol Implementation                                 β”‚
β”‚    β€’ Protobuf Serialization (Sub-ms Latency)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ WebSocket (gRPC)
                             β”‚ Solana RPC Connection
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Solana Blockchain                             β”‚
β”‚                                                                   β”‚
β”‚  β€’ PumpFun DEX          β€’ PumpSwap DEX                          β”‚
β”‚  β€’ Meteora DAMM V2      β€’ RPC Nodes                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components

Rust Server (Core Engine)

  • Handles all Solana-specific complexities
  • Real-time event streaming via Unix Socket + Protobuf
  • Transaction construction and execution via HTTP API
  • Multi-DEX protocol support

Your Strategy Bot (Any Language)

  • Subscribes to events via Unix Socket (ultra-low latency)
  • Receives parsed, structured trading events in Protobuf format
  • Sends high-level buy/sell commands via HTTP API
  • Focuses purely on trading logic

Why Unix Socket for Events?

  • 10x faster than WebSocket for local IPC
  • Zero network overhead - direct kernel communication
  • Sub-millisecond latency - critical for competitive trading
  • Binary protocol (Protobuf) - smaller payloads, faster parsing

πŸ“ Project Structure

Trading Server (Rust)

  • trading-bot-proxy-linux/ - Linux production server
  • trading-bot-proxy-mac/ - macOS development server
  • Configuration: config/app.toml

Trading Client (TypeScript Reference Implementation)

  • trading-bot-ts/ - Full-featured TypeScript client example
  • Demonstrates best practices and integration patterns
  • Detailed documentation: trading-bot-ts/README.md

πŸš€ Quick Start

1. Download and Extract

Linux:

# Download the Linux version
wget https://github.com/0xfnzero/trading-bot-proxy/releases/download/v1.0/trading-bot-proxy-linux.tar.bz2

# Extract the archive
tar -xjf trading-bot-proxy-linux.tar.bz2

# Navigate to the directory
cd trading-bot-proxy-linux

macOS:

# Download the macOS version
wget https://github.com/0xfnzero/trading-bot-proxy/releases/download/v1.0/trading-bot-proxy-mac.tar.bz2

# Extract the archive
tar -xjf trading-bot-proxy-mac.tar.bz2

# Navigate to the directory
cd trading-bot-proxy-mac

2. Configure and Start the Server

Configure:

vim config/app.toml  # Configure private key and RPC address

Linux:

chmod +x trading-bot-proxy
nohup ./trading-bot-proxy > output.log 2>&1 &

macOS:

chmod +x trading-bot-proxy
nohup ./trading-bot-proxy > output.log 2>&1 &

Server default port: http://localhost:8080

3. Start the Client

cd trading-bot-ts
npm install
cp .env.sample .env
vim .env  # Configure environment variables
npm run dev

For detailed instructions, please refer to: trading-bot-ts/README.md

βš™οΈ Important: Enable Protocol and Event Subscription

The server needs to set the corresponding protocols and events to true in config/app.toml to subscribe to data:

[protocols]
pumpfun = true  # Enable protocol as needed

[events]
pumpfun_trade = true  # Enable events as needed

Note: Only protocols and events set to true will be subscribed to and pushed to the client.

πŸ”§ Common Commands

# View logs
tail -f output.log

# Stop service
ps aux | grep trading-bot-proxy | grep -v grep | awk '{print $2}' | xargs kill

# Health check
curl http://localhost:8080/health

⚑ Performance Advantages

Rust vs Other Languages for Blockchain Operations

Metric Rust Proxy Pure Python Pure JavaScript
Event Processing Latency < 1ms 5-15ms 3-10ms
Memory Usage 50-100MB 200-500MB 150-400MB
Transaction Construction < 0.5ms 2-5ms 1-3ms
Concurrent Event Handling 10,000+ events/s 500-1,000 events/s 1,000-2,000 events/s
CPU Efficiency Minimal (5-10%) High (30-60%) Medium (20-40%)

Why Rust Matters in Trading

Latency is Everything

  • In competitive trading, milliseconds determine profit or loss
  • Rust's zero-cost abstractions mean no runtime overhead
  • Direct system calls without interpreter/VM layers

Reliability Under Load

  • No garbage collection pauses during critical operations
  • Predictable performance even under high throughput
  • Memory safety prevents crashes during peak trading hours

Strategy Development in Any Language

  • You get Rust's performance without writing Rust
  • Develop in Python for rapid prototyping
  • Switch to Go for production without changing the proxy
  • Use JavaScript for easy web integration

🎯 Use Cases

Perfect For

  • Algorithm Traders: Focus on strategy, not infrastructure
  • Quant Teams: Rapid strategy iteration without blockchain overhead
  • Trading Firms: Multi-strategy deployment with shared infrastructure
  • Researchers: Backtest and deploy with minimal code changes

Integration Example

For complete integration examples, please refer to the trading-bot-ts directory, which contains a detailed TypeScript client implementation demonstrating:

  • How to subscribe to event streams via Unix Socket
  • How to parse event messages using Protobuf
  • How to execute trading operations via HTTP API
  • How to implement complete trading strategy logic

⚠️ Important Notes

Security

  • Private Key Security: Keep your private keys in the configuration file secure
  • Never commit config/app.toml to version control
  • Use environment variables for production deployments

Performance

  • Recommended to use professional RPC nodes for best performance
  • Consider using multiple RPC endpoints for redundancy
  • Monitor latency metrics for optimal trading

Monitoring

  • Regularly check log files for errors and warnings
  • Set up alerts for connection issues
  • Monitor Redis memory usage for order management

Need Help?

About

High-performance Rust proxy that abstracts Solana DEX complexities into simple APIs, enabling developers to build trading bots in any language without blockchain expertise. Provides sub-millisecond event streaming and transaction execution for PumpFun, PumpSwap, and Meteora DAMM V2

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •