I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
When Solana's latest meme token dropped last week, I executed a snipe in just 400ms from block inclusion to successful arb. Here's the exact technical breakdown of how I built this system, covering Jito MEV bundles, Jupiter's routing API, and Helius RPC optimizations.
The Core Architecture
My sniper bot follows a 4-stage pipeline:
- Event Detection (100ms): Helius webhooks for new pool creations
- Arb Calculation (150ms): Jupiter API for optimal routes
- Bundle Construction (50ms): Jito's Bundle API formatting
- Execution (100ms): Priority RPC submission
Total latency: 400ms (measured via Traceroute and local timestamp diffs)
1. Event Detection with Helius
Helius' webhook system provides 200-300ms faster pool detection than polling public RPCs. I configured a custom webhook for ProgramLog: InitializePool events on Raydium:
const heliusWebhook = {
webhookURL: "https://my-sniper.com/api/pool-alert",
accountAddresses: ["RAYDIUM_LIQUIDITY_POOL_PROGRAM"],
transactionTypes: ["ProgramLog"],
webhookType: "enhanced"
};
// POST to https://api.helius.xyz/v0/webhooks?api-key=YOUR_KEY
Key optimization: Filtering for InitializePool logs reduces noise by 92% compared to listening to all Raydium transactions.
2. Jupiter Routing API
For immediate arb calculations, I bypass Jupiter's frontend and hit their v6 API directly:
async def get_best_route(input_mint, output_mint, amount):
params = {
"inputMint": input_mint,
"outputMint": output_mint,
"amount": amount,
"slippage": 0.5, # Aggressive for sniping
"onlyDirectRoutes": False
}
headers = {"Authorization": f"Bearer {JUPITER_KEY}"}
response = await session.get(
"https://quote-api.jup.ag/v6/quote",
params=params,
headers=headers
)
return await response.json()
Pro tip: Pre-warm connections to Jupiter's API servers (IPs: 54.192.19.0/24) to save 30-50ms on TLS handshakes.
3. Jito MEV Bundle Construction
Jito bundles allow packing multiple transactions with guaranteed ordering. My bundle builder:
let bundle = Bundle::new()
.with_blockhash(recent_blockhash)
.add_transaction(buy_tx) // Swap SOL → New Token
.add_transaction(sell_tx) // Swap New Token → SOL
.set_priority_fee(500_000); // MICROLAMPORTS
let serialized = bundle.serialize_to_packet();
Critical detail: Set recent_blockhash to the next slot's blockhash using Jito's block-engine stream:
wss://ny.mainnet.block-engine.jito.ws/api/v1/blocks/updates
4. Execution via Helius RPC
Standard RPC endpoints add 300-500ms latency. Helius' priority RPC cuts this to <100ms:
curl https://priority-rpc.helius.xyz \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "sendBundle",
"params": [
{
"encodedTransactions": ["base64_encoded_bundle"],
"options": {
"skipPreflight": true,
"priorityFee": 500000
}
}
]
}'
Latency Breakdown
| Component | Baseline (Public RPC) | Optimized Stack |
|---|---|---|
| Event Detection | 500ms (Polling) | 100ms (Webhook) |
| Route Calculation | 300ms (Cache Miss) | 150ms (Pre-Warm) |
| Bundle Submission | 400ms (Standard RPC) | 100ms (Priority) |
| Total | 1200ms | 400ms |
Key Lessons Learned
- Connection Pooling Matters: Maintaining 5-10 keepalive connections to Jupiter/Helius saved 80ms per request
- Bundle Fee Strategy: Setting priority fees to 0.5x the current slot's average prevented overbidding
- False Positive Filtering: 40% of new pools are scams - verify token metadata before swapping
Final Thoughts
Building a sub-500ms sniper requires tight integration across the Solana MEV stack. The key wasn't any single component, but eliminating every millisecond of overhead across the entire pipeline. With Jito bundles now dominating Solana block space, this approach consistently lands transactions in the first 10% of each slot.
Would love to hear others' experiences with latency optimization - what tricks have worked for your bots?
🚀 Try It Yourself & Get Airdropped
If you want to test this without building from scratch, use @ApolloSniper_Bot — the fastest non-custodial Solana sniper. When the bot hits $10M trading volume, the new $APOLLOSNIPER token will be minted and a massive 20% of the token supply will be airdropped to wallets that traded through the bot, based on their volume!
Join the revolution today.
Top comments (0)