I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
When Solana's latest meme token dropped last week, I built a sniper bot that executed in 400ms flat—from detecting the mint to confirmed on-chain swap. Here's the exact technical breakdown of how it worked, including the Jito MEV bundles, Jupiter routing tricks, and Helius RPC optimizations that made it possible.
The 400ms Breakdown
-
0-50ms: Helius webhook detects new mint (via
programSubscribeforspl-tokeninstructions) - 50-150ms: Bot fetches pool creation tx and derives liquidity pool address
- 150-250ms: Jupiter API computes optimal swap route (with enforced slippage limits)
- 250-400ms: Jito bundle submission and on-chain execution
Core Stack Components
1. Real-Time Mint Detection (Helius Webhooks)
Helius' enhanced RPC provides webhooks for program events without polling. Here's the subscription setup:
const subscription = await heliusConnection.programSubscribe(
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
(notification) => {
if (notification.type === 'tokenMint') {
handleNewMint(notification.account);
}
}
);
Key optimizations:
- Filtered for mints with
decimals=9andsupply=1,000,000,000(common meme token pattern) - Verified creator wallet had previous LP creations
- Rejected mints with >5% tax (avoided honeypots)
2. Jito MEV Bundle Engineering
Jito bundles allow packing multiple transactions with guaranteed execution order. The magic sauce:
const bundle = {
transactions: [
priorityTx, // Our swap
cleanupTx // Arbitrage back to USDC
],
blockhash: latestBlockhash,
priorityFee: 500000, // 0.5 SOL in micro-lamports
};
Critical details:
- Used
@jito-labs/searcherSDK for bundle construction - Set
recentBlockhashfrom streamed block data (not RPC call) - Included a follow-up arbitrage tx to capture residual value
3. Jupiter Swap Routing
Jupiter's v6 API provides optimized routes with price impact analysis. The killer feature:
params = {
'inputMint': 'So11111111111111111111111111111111111111112',
'outputMint': new_token_mint,
'amount': 0.1 * 10**9, // 0.1 SOL
'slippageBps': 500, // 5%
'onlyDirectRoutes': False,
'asLegacyTransaction': True // Faster execution
}
response = requests.get('https://quote-api.jup.ag/v6/quote', params=params)
Pro tips:
- Cached API responses for 50ms (most pools repeat)
- Pre-warmed HTTP connections to Jupiter's LB
- Used
onlyDirectRoutesfor sub-100ms token launches
Performance Benchmarks
- Helius webhook latency: 23ms ±5ms (vs 300ms+ for traditional RPC polling)
- Jito bundle inclusion rate: 92% at 500μSOL priority fee
- Swap success rate: 84% (failed when others sniped faster)
Lessons Learned the Hard Way
- Gas estimation is critical: Underestimating led to 15% bundle failures until I implemented dynamic fee adjustment based on recent block congestion.
- False positive filtering: Early versions wasted $800 on testnet mints before adding creator wallet analysis.
- RPC redundancy: Had to fallback to QuickNode when Helius had brief downtime during peak congestion.
The Full Code Architecture
Here's the core event loop pseudocode:
loop {
let mint_event = helius_webhook.receive();
if !is_viable_mint(mint_event) { continue; }
let pool_info = derive_pool(mint_event.mint);
let quote = jupiter.get_quote(pool_info);
let bundle = build_jito_bundle(
swap_tx: quote.to_tx(),
cleanup_tx: build_arb_tx()
);
jito_searcher.send_bundle(bundle);
}
Conclusion
Building a sub-500ms Solana sniper requires deep integration with specialized infrastructure like Jito's block engine and Helius' optimized RPC. The key was minimizing sequential operations—every millisecond counts when competing against hundreds of bots. While the code appears simple, the real complexity lies in the dozens of micro-optimizations around networking, fee estimation, and false positive filtering.
This same stack can be adapted for NFT mints, arbitrage, or liquidation bots—just swap out the mint detection logic. Happy to answer technical questions in the comments.
🚀 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)