Copy-trading infrastructure for mirroring target wallets across Solana DEX ecosystems.
The validator listens to high-value actors, reconstructs their instructions, and rebroadcasts optimized copies with custom compute budgets and priority fees for near-zero-slot confirmations.
- Multi-DEX Coverage – Supports Pump.fun spot trades, LaunchLab primary sales, Raydium AMM / CPMM / CLMM pools, and custom PumpSwap events.
- Slot-Optimized Execution – Builder pipeline pre-calculates compute-unit budgets and tip pricing for faster inclusion (observed 0–1 block settlements).
- 0-Block Copy Transactions – Supports near-instant transaction mirroring for Pumpswap, CPMM, and AMM protocols with optimized routing.
- Auto-Sell Logic – Automated position management with take profit, stop loss, trailing stop loss, and lifetime-based selling.
- Resilient Signature Watcher – Deduplicates source signatures and replays with configurable cooldowns to avoid double-spends.
- Accounts Auto-Wiring – Instruction builders expand Anchor PDAs such as
fee_config,global_volume_accumulator, and event authorities. - Modular Instruction Decoders – Each program family (Pumpfun, Raydium, LaunchLab) exposes
ArrangeAccountsadapters to translate raw transactions into actionable instructions. - Operational Telemetry – Timestamped logging per event, including time-to-submit, decode summaries, and RPC outcomes.
| Component | Role |
|---|---|
main.rs |
Entry point. Sets up YellowStone gRPC data feed, metrics pipeline, and registers all instruction processors. |
PumpfunProcess |
Handles Pump.fun buy/sell signatures. Parses TradeEvent, injects compute budget instructions, mirrors target trades, and manages ATA lifecycle. |
RaydiumV4Process, RayCpmmProcess, RayClmmProcess |
Decode respective Raydium protocol instructions and dispatch mirrored swaps. |
RayLaunchPadProcess |
Mirrors LaunchLab buy/sell flows, respecting pool-specific account layouts. |
src/instructions/* |
Instruction builders that reconstruct Anchor-style account metas and instruction data for each action type. |
src/utils/parse.rs |
Helpers for token balances, swap quotes, and post-trade analytics. |
src/config/trade_setting.rs |
Centralized environment-driven configuration (CU, PRIORITY_FEE_MICRO_LAMPORT, BUY_SOL_AMOUNT, SLIPPAGE, etc.). |
All processors implement carbon_core::processor::Processor, enabling plug-and-play registration with the carbon pipeline.
Create a .env file at the repository root:
RPC_URL=https://api.mainnet-beta.solana.com
LOCAL_GRPC_URL=...
TARGET_WALLET=Hhu1oJftG4CAQzJGT3fYtH6QdDZFVxzn7PK6qe8sqD15
PUBKEY=EoMbdLTgbMm23ES81WrM7gqqqr9EUqZ65W259jwn7oWJ
PRIVATE_KEY=[base58-or-array]
# Execution tuning
CU=400000
PRIORITY_FEE_MICRO_LAMPORT=5000
THIRD_PARTY_FEE=0.0005
BUY_SOL_AMOUNT=0.01
SLIPPAGE=1.0
# Auto-sell configuration
AUTO_SELL_ENABLED=true
TAKE_PROFIT_PERCENT=10.0
STOP_LOSS_PERCENT=5.0
TRAILING_STOP_LOSS_PERCENT=3.0
AUTO_SELL_LIFETIME_SECONDS=30
PRICE_CHECK_INTERVAL_SECONDS=5
# Optional: Jito bundle support for 0-block transactions
JITO_API_URL=https://mainnet.block-engine.jito.wtf
Unset (or zero) values for CU / PRIORITY_FEE_MICRO_LAMPORT automatically skip compute-budget instructions.
- Install Rust toolchain (
rustup, nightly not required). - Fetch dependencies:
cargo fetch
- Start the monitor:
cargo run --release
- Watch logs for decoded events (time-stamped with latency measurements). Successful mirrors print the encoded transaction signature or RPC error payload.
The pipeline keeps a rolling cache of processed source signatures to protect against replay.
- Detects
TradeEventinner instructions, reconstructs account PDAs (user, bonding curve, fee config). - Auto-creates idempotent ATAs before buys; closes empty ATAs after sells.
- Computes target token/SOL amounts using bonding curve virtual reserve math (
sol_token_quote,token_sol_quote). - Example mirrored sells (Slot + confirmation in <2 ms):
- Replays LaunchLab sell-side exits with proper fee routing and ATA wiring.
- Includes fee tier PDAs (
fee_config,fee_program) to satisfy latest Anchor constraints. - Example mirrored sells:
- Decoders map swap events to
SwapBaseIn,SwapBaseInput, andSwapV2flows. - Automated ATA derivations (via
derive_associated_token_address) and quote lookups for size calculation. - Example AMM buys:
-
Pumpswap 0-Block Buy – Mirrors Pumpswap buy transactions immediately for same-block or next-block inclusion.
-
CPMM 0-Block Buy – Mirrors Raydium CPMM swap transactions with 0-block optimization.
-
AMM 0-Block Buy – Mirrors Raydium AMM swap transactions with 0-block optimization.
- Take Profit – Automatically sells when price reaches the configured profit percentage (default: 10%).
- Stop Loss – Protects against losses by selling when price drops below the configured threshold (default: 5%).
- Trailing Stop Loss – Dynamic stop loss that follows the highest price, selling if price drops by the configured percentage from the peak (default: 3%).
- Lifetime-Based Selling – Automatically sells positions after a configured lifetime in seconds (default: 30 seconds).
- Price Monitoring – Continuously monitors token prices at configured intervals (default: 5 seconds) to trigger auto-sell conditions.
- Set
CONFIRM_SERVICEtoNOZOMI,ZERO_SLOT, orJITOto route tips through external relays (disabled by default). - The monitor spawns a background task (
recent_blockhash_handler) to keep slot info fresh for signing. SIGNATUREScache automatically purges after 3 seconds; adjust if copying frequent multi-leg transactions.- Continuous logging of start-to-submit elapsed time helps track RPC health (e.g.,
Period from start: 509.438792ms).
- Wallet management UI for swapping target addresses on the fly.
- Quote engine integration with Jupiter for fallback route discovery.
- Persistent metrics sink beyond console (InfluxDB / Prometheus).
- Automated slippage tuning fed by historical fill rates.
- Telegram: https://t.me/Kei4650
- Twitter: https://x.com/kei_4650
Happy mirroring! For troubleshooting or feature requests, open an issue or reach out directly.