I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
Last week I successfully frontran a trending Solana token launch, executing my snipe in just 400ms from block production. Here's the exact technical breakdown of how I built this MEV (Maximal Extractable Value) sniper bot using Jito bundles, Jupiter routing, and Helius RPC endpoints.
The MEV Opportunity on Solana
Solana's 400ms block times create intense competition for sandwich attacks and token snipes. Unlike Ethereum where you have 12-second blocks, Solana requires sub-second execution. The key components that made this possible:
- Jito MEV Bundles: For priority block positioning
- Jupiter API: For optimal swap routing
- Helius RPC: For low-latency blockchain access
- Rust + Anchor: For fast transaction construction
The Technical Stack Breakdown
1. Jito Bundle Construction
Jito bundles allow you to submit transactions that execute atomically at the top of blocks. Here's how I constructed mine:
use jito_bundle::Bundle;
use solana_sdk::transaction::Transaction;
let mut bundle = Bundle::new();
let priority_fee = 500_000; // 0.5 SOL priority fee
// Snipe transaction
let snipe_tx = build_snipe_transaction(&new_token_mint);
bundle.add_transaction(snipe_tx, priority_fee);
// Backup cleanup transaction
let cleanup_tx = build_cleanup_transaction();
bundle.add_transaction(cleanup_tx, 0);
Key parameters I tuned:
- Priority fees: 0.5-1 SOL for top block placement
- Bundle size: 2-3 transactions max (more increases failure risk)
- Gas limits: 1.5x estimated compute units
2. Jupiter Swap Integration
I used Jupiter's API for optimal routing when dumping the token. Their v6 API provides lightning-fast quote generation:
const jupiterQuote = await fetch('https://quote-api.jup.ag/v6/quote', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
inputMint: 'So11111111111111111111111111111111111111112', // SOL
outputMint: NEW_TOKEN_MINT,
amount: 0.1 * 1e9, // 0.1 SOL in lamports
slippageBps: 500, // 5% slippage
onlyDirectRoutes: false
})
});
Critical optimizations:
- Pre-warming quote cache before bundle submission
- Using onlyDirectRoutes=false for better pricing
- Setting aggressive 5-10% slippage during volatile launches
3. Helius RPC Configuration
Helius provided the low-latency RPC connection needed. My setup:
HELIUS_URL = "https://mainnet.helius-rpc.com/?api-key=YOUR_KEY"
async def send_bundle(bundle):
async with aiohttp.ClientSession() as session:
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "sendBundle",
"params": [bundle.serialize()]
}
async with session.post(HELIUS_URL, json=payload) as resp:
return await resp.json()
Performance metrics:
- 35ms average ping time to Helius vs 120ms on public RPCs
- 99.8% uptime during high congestion periods
- Bundle acceptance rate: ~92% vs ~65% on public endpoints
The Snipe Execution Flow
Here's the complete sequence with timings:
- Token Detection (T+0ms): Monitoring new Raydium pools via websocket
- Bundle Construction (T+50ms): Building Jito bundle with snipe tx
- Jupiter Routing (T+100ms): Getting swap quote for exit liquidity
- Bundle Submission (T+150ms): Sending to Helius RPC
- Block Inclusion (T+400ms): Bundle lands in next block
The critical path was getting steps 2-4 completed in under 250ms to reliably hit the next block.
Lessons Learned the Hard Way
Bundle Size Matters: My first version had 5 transactions - the failure rate was 40%. Reducing to 2-3 brought it down to 8%.
Priority Fee Optimization: There's a sweet spot around 0.5 SOL where you get reliable inclusion without overpaying. I wasted about 5 SOL testing this.
RPC Selection is Critical: Public RPCs failed me during two major snipes. The $99/month Helius pro plan paid for itself immediately.
Error Handling is Everything: 30% of snipes fail - having automatic refunds and cleanup saved me thousands in stuck funds.
The Complete Rust Sniper Core
Here's the heart of the sniper bot:
pub async fn execute_snipe(
new_mint: Pubkey,
payer: Keypair,
jito_auth: Keypair,
) -> Result<()> {
// 1. Build buy transaction
let buy_ix = build_buy_instruction(&new_mint, payer.pubkey());
let buy_tx = Transaction::new_signed_with_payer(
&[buy_ix],
Some(&payer.pubkey()),
&[&payer],
recent_blockhash,
);
// 2. Build sell transaction via Jupiter
let sell_ix = get_jupiter_swap_ix(&new_mint).await?;
let sell_tx = Transaction::new_signed_with_payer(
&[sell_ix],
Some(&payer.pubkey()),
&[&payer],
recent_blockhash,
);
// 3. Construct Jito bundle
let mut bundle = Bundle::new();
bundle.add_transaction(buy_tx, 500_000);
bundle.add_transaction(sell_tx, 0);
// 4. Submit bundle
let client = HeliusClient::new(HELIUS_API_KEY);
client.send_bundle(bundle, &jito_auth).await?;
Ok(())
}
Final Performance Metrics
After optimizing:
- Average execution time: 380-420ms
- Success rate: 68% on new token launches
- ROI: ~4.2 SOL profit per successful snipe
- Best snipe: 22 SOL profit on a trending meme coin
Conclusion
Building a competitive Solana MEV bot requires optimizing every microsecond. The combination of Jito for block positioning, Jupiter for efficient swaps, and Helius for reliable RPC access created a system that could reliably snipe tokens in under half a second. The key was reducing latency at every layer - from transaction construction to RPC communication. While the space is increasingly competitive, there are still opportunities for those willing to dive deep into Solana's technical stack.
🚀 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)