High-performance UNIX Socket server for streaming Solana DEX events with microsecond-level latency
δΈζ | English | Website | Telegram | Discord
A UNIX Socket proxy server for Solana DEX events based on sol-parser-sdk. Real-time monitoring of DEX trading events from PumpFun, Raydium, Orca, Meteora, and more, streamed to clients via UNIX Socket with protobuf serialization.
- π₯ Ultra-low Latency - Built on sol-parser-sdk with 10-20ΞΌs parsing latency
- π Real-time UNIX Socket Push - Support multiple concurrent client connections with protobuf
- π Multi-protocol Support - PumpFun, PumpSwap, Raydium AMM V4/CLMM, Orca Whirlpool, Meteora, etc.
- π― Event Filtering - Only push events you care about
- βοΈ TOML Configuration - All parameters flexibly configurable via config file
- π Auto Reconnection - Automatic client cleanup on disconnect
- π Multi-language Clients - TypeScript client with real-time streaming
- π Library Support - Use as both standalone binary and Rust library
- π οΈ Easy Integration - Simple API for custom implementations
βββββββββββββββββββ
β Yellowstone gRPCβ
β (Solana RPC) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β sol-parser-sdk β
β (10-20ΞΌs parse)β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β UNIX Socket β
β Server β
β (Broadcast) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β Clients (TS/Python/...) β
β (Real-time DEX Events) β
βββββββββββββββββββββββββββββββββββββββ
- Rust (1.70+): Install Rust
- Node.js (18+): Install Node.js (for client examples)
- Protocol Buffers: Install protobuf
git clone https://github.com/0xfnzero/parser-proxy-unixsocket.git
cd parser-proxy-unixsocket# Build the Rust server
cargo build --release
# Install client dependencies (optional)
cd examples
npm install
cd ..# The build script automatically generates protobuf files
cargo build# Test the server
cargo run --release -- --help
# Test the client
cd examples
npm startEdit config.toml:
[server]
unix_socket_path = "/tmp/parser_proxy.sock"
[grpc]
endpoint = "https://solana-yellowstone-grpc.publicnode.com:443"
token = "" # Optional: your gRPC token
enable_metrics = true
enable_tls = true
connection_timeout_ms = 10000
request_timeout_ms = 30000
[protocols]
pumpfun = true
pumpswap = false
raydium_amm_v4 = false
raydium_clmm = false
orca_whirlpool = false
meteora_pools = false
meteora_damm_v2 = false
[events]
# PumpFun events
pumpfun_trade = true
pumpfun_create = true
pumpfun_migrate = true
# PumpSwap events
pumpswap_buy = false
pumpswap_sell = false
pumpswap_create_pool = false
pumpswap_liquidity_added = false
pumpswap_liquidity_removed = false
# Raydium AMM V4 events
raydium_amm_v4_swap = false
# Raydium CLMM events
raydium_clmm_swap = false
# Orca Whirlpool events
orca_whirlpool_swap = false
# Meteora Pools events
meteora_pools_swap = false
# Meteora DAMM V2 events
meteora_damm_v2_swap = false
meteora_damm_v2_add_liquidity = false
meteora_damm_v2_remove_liquidity = false
meteora_damm_v2_create_position = false
meteora_damm_v2_close_position = falsecargo run --releaseServer will start based on config file (default UNIX socket at /tmp/parser_proxy.sock)
cd examples
npm install
npm start⨠Features:
- Auto-convert using protobufjs
- Terminal real-time event display (with colors)
- TypeScript type safety
- Real-time event streaming
- Automatic reconnection
| Protocol | Config Field | Description |
|---|---|---|
| PumpFun | protocols.pumpfun |
PumpFun Meme token trading |
| PumpSwap | protocols.pumpswap |
PumpSwap exchange protocol |
| Raydium AMM V4 | protocols.raydium_amm_v4 |
Raydium Automated Market Maker V4 |
| Raydium CLMM | protocols.raydium_clmm |
Raydium Concentrated Liquidity MM |
| Orca Whirlpool | protocols.orca_whirlpool |
Orca Whirlpool Concentrated Liquidity |
| Meteora Pools | protocols.meteora_pools |
Meteora Dynamic AMM |
| Meteora DAMM V2 | protocols.meteora_damm_v2 |
Meteora Dynamic AMM V2 |
Each protocol supports the following event types (enable in [events] config section):
- π Trade/Swap - Trading/swapping events
- π§ Deposit - Add liquidity
- πΈ Withdraw - Remove liquidity
- π Create/Initialize - Pool creation/initialization
- π Migrate - Migration events
| Event Type | Config Field | Description |
|---|---|---|
| PumpFun Events | ||
| PumpFun Trade | pumpfun_trade |
PumpFun trading events |
| PumpFun Create | pumpfun_create |
PumpFun token creation events |
| PumpFun Migrate | pumpfun_migrate |
PumpFun migration events |
| PumpSwap Events | ||
| PumpSwap Buy | pumpswap_buy |
PumpSwap buy events |
| PumpSwap Sell | pumpswap_sell |
PumpSwap sell events |
| PumpSwap Create Pool | pumpswap_create_pool |
PumpSwap pool creation events |
| PumpSwap Liquidity Added | pumpswap_liquidity_added |
PumpSwap liquidity added events |
| PumpSwap Liquidity Removed | pumpswap_liquidity_removed |
PumpSwap liquidity removed events |
| Raydium AMM V4 Events | ||
| Raydium AMM V4 Swap | raydium_amm_v4_swap |
Raydium AMM V4 swap events |
| Raydium CLMM Events | ||
| Raydium CLMM Swap | raydium_clmm_swap |
Raydium CLMM swap events |
| Orca Whirlpool Events | ||
| Orca Whirlpool Swap | orca_whirlpool_swap |
Orca Whirlpool swap events |
| Meteora Events | ||
| Meteora Pools Swap | meteora_pools_swap |
Meteora Pools swap events |
| Meteora DAMM V2 Events | ||
| Meteora DAMM V2 Swap | meteora_damm_v2_swap |
Meteora DAMM V2 swap events |
| Meteora DAMM V2 Add Liquidity | meteora_damm_v2_add_liquidity |
Meteora DAMM V2 add liquidity events |
| Meteora DAMM V2 Remove Liquidity | meteora_damm_v2_remove_liquidity |
Meteora DAMM V2 remove liquidity events |
| Meteora DAMM V2 Create Position | meteora_damm_v2_create_position |
Meteora DAMM V2 create position events |
| Meteora DAMM V2 Close Position | meteora_damm_v2_close_position |
Meteora DAMM V2 close position events |
[server]
unix_socket_path = "/tmp/parser_proxy.sock" # UNIX socket path[grpc]
endpoint = "https://solana-yellowstone-grpc.publicnode.com:443"
token = "" # gRPC auth token (optional)
enable_metrics = true # Enable performance metrics
enable_tls = true # Enable TLS
connection_timeout_ms = 10000 # Connection timeout (ms)
request_timeout_ms = 30000 # Request timeout (ms)Enable/disable specific protocols and events via config:
[protocols]
pumpfun = true # Enable PumpFun protocol
raydium_amm_v4 = false # Disable Raydium AMM V4
[events]
pumpfun_trade = true # Enable PumpFun trade events
pumpfun_create = false # Disable PumpFun create eventsNote: At least one protocol and one event type must be enabled, otherwise server will fail to start
The server uses protobuf serialization for messages with the following format:
message ServerMessage {
oneof message {
ServerAck ack = 1; // Server acknowledgment
DexEvent event = 2; // DEX event
ServerError error = 3; // Error response
ServerHeartbeat heartbeat = 4; // Server heartbeat
}
}message DexEvent {
string event_type = 1; // Event type identifier
oneof event_detail {
// PumpFun events
PumpFunTradeEvent pumpfun_trade = 2;
PumpFunCreateEvent pumpfun_create = 3;
PumpFunMigrateEvent pumpfun_migrate = 4;
// PumpSwap events
PumpSwapBuyEvent pumpswap_buy = 5;
PumpSwapSellEvent pumpswap_sell = 6;
PumpSwapCreatePoolEvent pumpswap_create_pool = 7;
PumpSwapLiquidityAddedEvent pumpswap_liquidity_added = 8;
PumpSwapLiquidityRemovedEvent pumpswap_liquidity_removed = 9;
// Raydium events
RaydiumClmmSwapEvent raydium_clmm_swap = 10;
RaydiumAmmV4SwapEvent raydium_amm_v4_swap = 11;
// Orca events
OrcaWhirlpoolSwapEvent orca_whirlpool_swap = 12;
// Meteora events
MeteoraPoolsSwapEvent meteora_pools_swap = 13;
// Meteora DAMM V2 events
MeteoraDammV2SwapEvent meteora_damm_v2_swap = 14;
MeteoraDammV2AddLiquidityEvent meteora_damm_v2_add_liquidity = 15;
MeteoraDammV2RemoveLiquidityEvent meteora_damm_v2_remove_liquidity = 16;
MeteoraDammV2CreatePositionEvent meteora_damm_v2_create_position = 17;
MeteoraDammV2ClosePositionEvent meteora_damm_v2_close_position = 18;
}
}All events include base metadata:
message EventMetadata {
string signature = 1; // Transaction signature
uint64 slot = 2; // Slot number
uint64 tx_index = 3; // Transaction index in slot
int64 block_time_us = 4; // Block timestamp (microseconds)
int64 grpc_recv_us = 5; // gRPC receive timestamp (microseconds)
}This project can be used as both a standalone binary and as a Rust library. Here's how to use it in your Rust project:
[dependencies]
parser-proxy-unixsocket = "0.1.1"
tokio = { version = "1.42.0", features = ["full"] }use parser_proxy_unixsocket::run_server;
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
// Start server with config file
run_server("config.toml").await?;
Ok(())
}use parser_proxy_unixsocket::ParserProxyServer;
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
// Create server
let server = ParserProxyServer::new("config.toml")?;
// Start server (this will run indefinitely)
server.run().await?;
Ok(())
}- Binary: Enable the
binaryfeature for standalone usage - Default: Core library functionality
[dependencies]
parser-proxy-unixsocket = { version = "0.1.1", features = ["binary"] }parser-proxy-unixsocket/
βββ src/
β βββ main.rs # Main entry point
β βββ lib.rs # Library entry point
β βββ config.rs # Config file loading and parsing
β βββ unix_socket_server.rs # UNIX socket server implementation
β βββ event_converter.rs # Event converter
βββ examples/
β βββ client.ts # TypeScript client example
β βββ parser_messages.js # Generated protobuf JavaScript
β βββ parser_messages.d.ts # TypeScript definitions
β βββ package.json # Node.js dependencies
β βββ tsconfig.json # TypeScript configuration
βββ proto/
β βββ messages.proto # Protocol buffer definitions
βββ config.toml # Configuration file
βββ config.toml.example # Example configuration
βββ Cargo.toml # Rust project config
βββ build.rs # Build script for protobuf
βββ README.md # English documentation
βββ README_CN.md # Chinese documentation
βββ LICENSE # MIT License
When adding new protocols, you only need to:
- Add new message definitions in proto/messages.proto
- Add new fields in the DexEvent oneof
- Add corresponding match branches in Rust conversion functions
- Add parsing logic in TypeScript client
cargo testPerformance metrics are displayed when server starts:
π gRPC receive time: 1234567890 ΞΌs
β‘ Event parsing took: 15 ΞΌs
- Trading Bots - Real-time DEX monitoring for arbitrage strategies
- Price Monitoring - Track trading prices of specific tokens
- New Token Alerts - Monitor new token creation events
- Liquidity Analysis - Analyze DEX liquidity changes
- Data Analytics - Collect on-chain trading data for analysis
MIT License
- sol-parser-sdk - Solana DEX event parsing library
- Yellowstone gRPC - Solana gRPC interface
For issues or suggestions, please submit an Issue.