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 transaction in just 400 milliseconds. 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—with real code and hard-won lessons.
The Problem: Solana’s Speed Requires Extreme Optimization
Solana’s 400ms block times mean traditional Ethereum MEV strategies won’t work. You need:
- Sub-100ms RPC latency (Helius)
- Pre-emptive transaction bundling (Jito)
- Optimal swap routing (Jupiter)
- Pre-signed transactions to bypass wallet confirmation delays
The Stack: From Detection to Execution
1. Token Detection (50ms)
I used a custom websocket listener on Solana’s programSubscribe to catch new token mints in real-time:
const connection = new Connection(HELIUS_RPC_URL, "confirmed");
connection.onProgramAccountChange(
TOKEN_PROGRAM_ID,
(accountInfo) => {
const mintData = parseMintData(accountInfo.account.data);
if (isNewMemeToken(mintData)) {
snipeQueue.push(mintData.mint);
}
},
"finalized"
);
Key Insight: Helius’s websockets have ~30ms faster response times than public RPCs.
2. Jito MEV Bundles (Critical for Frontrunning)
Jito bundles let you submit multiple transactions as an atomic unit, ensuring your snipe executes before others. Here’s how I constructed one:
import { Bundle } from "@jito-labs/core";
const bundle = new Bundle();
bundle.addTransaction(await createApproveTx()); // Pre-approve
bundle.addTransaction(await createBuyTx()); // Buy
bundle.addTransaction(await createSellTx()); // Instant sell
const jitoResponse = await jitoClient.sendBundle(bundle);
Lesson Learned: Always include a sell tx in the same bundle—otherwise, you risk getting sandwiched.
3. Jupiter Routing (Best Price Execution)
Jupiter’s API finds the optimal swap route, even for new tokens with low liquidity:
import requests
jupiter_url = "https://quote-api.jup.ag/v6/quote"
params = {
"inputMint": "So111111...",
"outputMint": NEW_TOKEN_MINT,
"amount": 0.1 * 1e9, # 0.1 SOL
"slippage": 5, # 5% max
}
response = requests.get(jupiter_url, params=params)
best_route = response.json()["route"]
Pro Tip: Use slippageBps for tighter control (e.g., 500 = 5%).
4. Pre-Signing Transactions (Saving 200ms+)
Wallet popups kill speed. I pre-signed transactions using @solana/web3.js and a hot wallet:
const { blockhash } = await connection.getLatestBlockhash();
const tx = new Transaction({
feePayer: wallet.publicKey,
recentBlockhash: blockhash,
}).add(
// Your instructions here
);
const signedTx = await wallet.signTransaction(tx);
const serializedTx = signedTx.serialize();
// Store for instant submission
Critical: Refresh blockhash every 30 seconds to avoid stale transactions.
Execution Flow: 0ms to 400ms Breakdown
- 0ms: Token mint detected via Helius websocket.
- 50ms: Jupiter API fetches best swap route.
- 100ms: Transactions pre-signed and bundled via Jito.
- 300ms: Bundle submitted to Jito searcher.
- 400ms: Transaction lands on-chain.
Lessons Learned (The Hard Way)
- RPC Latency Matters: Public RPCs added 150ms+ vs. Helius.
-
Bundle Failures Happen: Always monitor Jito’s
bundleStatus. - Gas Wars Are Brutal: For ultra-competitive tokens, I set priority fees up to 0.01 SOL.
Final Thoughts
Solana MEV is a race against time. By combining Jito’s bundles, Jupiter’s routing, and Helius’s speed, I consistently snipe tokens before bots using slower stacks. The key? Pre-sign, bundle, and route—all before the next block.
Want the full code? Drop a comment—I’ll open-source a simplified version.
🚀 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)