I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
When Solana's new token $XYZ launched last week, I executed a snipe in 400ms flat. Here's the exact technical breakdown of how I built this MEV (Maximal Extractable Value) bot using Jito bundles, Jupiter routing, and Helius RPC—complete with code snippets and hard-won lessons.
The Challenge: Speed and Precision
Token sniping on Solana requires:
- Sub-second execution (Solana's block time is ~400ms)
- Atomic transactions (no front-running or reverts)
- Optimal routing (best swap path with minimal slippage)
The Stack That Made It Possible
1. Jito MEV Bundles (The Speed Multiplier)
Jito bundles let you submit multiple transactions atomically, ensuring your snipe executes before others. Unlike Ethereum, Solana doesn't have a mempool, so Jito’s "Bundle" system is critical.
Key Code Snippet (Rust + Anchor):
let bundle_tx = Bundle::new(vec![
// 1. Create associated token account (ATA)
create_associated_token_account(&payer, &mint),
// 2. Swap SOL -> XYZ via Jupiter
swap_instruction(&jupiter_program, &route),
// 3. Set up LP if needed
initialize_liquidity_pool(&amm_program, &pool_keys)
]);
let jito_client = JitoClient::new("https://mainnet.jito.wtf");
jito_client.send_bundle(bundle_tx).await?;
Why This Works:
- Atomic execution: All 3 steps succeed or fail together.
- Priority fee: Jito bundles include a tip (~0.001 SOL) to prioritize inclusion.
2. Jupiter Routing (Optimal Swaps)
Jupiter aggregates DEXs (Orca, Raydium, etc.) to find the best swap path. Their API returns routes in ~50ms, critical for sniping.
Python Example (Jupiter API Call):
import requests
params = {
"inputMint": "So11111111111111111111111111111111111111112", # SOL
"outputMint": "XYZ...", # New token
"amount": 0.1 * 10**9, # 0.1 SOL in lamports
"slippage": 1, # 1%
}
response = requests.get("https://quote-api.jup.ag/v6/quote", params=params)
best_route = response.json()["data"][0]
Pro Tip: Cache Jupiter routes for known tokens to save precious milliseconds.
3. Helius RPC (Low-Latency Data)
Public RPCs are too slow (~500ms+). Helius’s dedicated endpoints gave me sub-100ms response times.
Node.js Setup:
const { Connection } = require("@solana/web3.js");
const heliusConnection = new Connection(
"https://mainnet.helius-rpc.com/?api-key=YOUR_KEY",
{ commitment: "confirmed" }
);
// Listen for new tokens
heliusConnection.onProgramAccountChange(
new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
(accountInfo) => {
// Parse new mint here
}
);
Why Helius?
- WebSocket streams: Real-time alerts for new tokens.
-
Enhanced APIs: Faster
getAccountInfoandgetProgramAccounts.
Execution Flow (400ms Breakdown)
- 0ms: Helius WebSocket detects new token.
- 50ms: Jupiter API fetches best route.
- 100ms: Construct Jito bundle (ATA + swap).
- 150ms: Sign and submit bundle.
- 400ms: Bundle lands in block—snipe successful.
Lessons Learned the Hard Way
- Gas Matters: Underestimating priority fees = bundle dropped. I lost 0.5 SOL testing this.
-
Error Handling: Check for
ATAexistence—failed bundles cost SOL. - Rate Limits: Jupiter’s API throttles at 100 RPM; use multiple API keys.
Final Thoughts
Sniping on Solana is a race against time and other bots. By combining Jito (atomicity) + Jupiter (routing) + Helius (speed), I consistently land snipes in <500ms. The key is optimizing every millisecond—from RPC calls to bundle construction.
Next, I’m exploring Flash Loans on Solana—let me know if you’d like a deep dive on that. Happy sniping!
🚀 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)