I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
When Solana's congestion was at its peak, I built a system that could snipe new token launches in under half a second. Here's the exact architecture, code, and painful lessons learned from running this in production.
Why 400ms Matters
Solana's block time is ~400ms. If your sniper isn't faster than this, you're already losing to MEV bots. My goal was to:
- Detect new pools on Raydium/Jupiter
- Construct the optimal swap route
- Submit as a Jito bundle before the next block
The Stack That Made It Possible
1. Real-Time Data: Helius RPC
Standard RPC endpoints couldn't keep up. Helius' WebSocket streams gave me:
-
3ms latency on
programSubscribefor Raydium pool creations -
8ms response times for
getMultipleAccounts(vs 200ms+ on public RPCs)
const heliusConnection = new Connection(
'wss://mainnet.helius-rpc.com/?api-key=YOUR_KEY',
{ wsEndpoint: 'wss://mainnet.helius-rpc.com' }
);
// Listen for new Raydium pools
heliusConnection.onProgramAccountChange(
new PublicKey('RAYDIUM_LP_PROGRAM_ID'),
async (updatedAccountInfo) => {
const poolData = parsePoolData(updatedAccountInfo.account.data);
if (isNewPool(poolData)) {
await snipeFlow(poolData);
}
}
);
2. Jito MEV Bundles (The Secret Weapon)
Normal transactions get stuck in Solana's mempool. Jito bundles let you:
- Pay priority fees in SOL and tip block builders
- Guarantee execution in the next block (if you bid enough)
My bundle construction:
import { Bundle } from '@jito-labs/core';
const buildSnipeBundle = async (swapTx: Transaction) => {
const blockEngineUrl = 'https://amsterdam.mainnet.block-engine.jito.wtf/api/v1/bundles';
const bundle = new Bundle([swapTx], 5); // 5 = priority fee in lamports
bundle.setTip(0.001 * LAMPORTS_PER_SOL); // Tip to block builder
const response = await fetch(blockEngineUrl, {
method: 'POST',
headers: { 'Authorization': `Bearer ${JITO_KEY}` },
body: JSON.stringify(bundle.toJSON()),
});
if (!response.ok) throw new Error('Bundle submission failed');
};
3. Jupiter Swap API for Optimal Routing
Manually constructing swaps is slow. Jupiter's API finds the best route across all DEXs in 12ms (my local testing):
const fetchJupiterRoute = async (inputMint, outputMint, amount) => {
const response = await axios.get(
`https://quote-api.jup.ag/v6/quote?inputMint=${inputMint}&outputMint=${outputMint}&amount=${amount}&slippage=0.5`
);
return {
swapTransaction: response.data.swapTransaction,
route: response.data.route
};
};
Key optimization: Pre-fetch routes for common token pairs and cache them in Redis.
The Full 400ms Pipeline
- 0ms: Helius WebSocket detects new pool
- 20ms: Fetch pool liquidity via Helius RPC
- 32ms: Request Jupiter swap route
- 44ms: Construct transaction with priority fee
- 60ms: Submit as Jito bundle
- 400ms: Included in next block
Painful Lessons Learned
- Wallet Hot/Cold Separation My first version used the same wallet for monitoring and sniping. Result: An exploit drained 22 SOL when I accidentally signed a malicious TX.
Fix:
// Monitoring wallet (read-only)
const monitorWallet = Keypair.fromSeed(monitorSeed);
// Sniper wallet (air-gapped)
const sniperWallet = new NodeWallet(sniperKeypair);
Gas Estimation Is a Lie
Solana'sgetFeeForMessageunderestimates during congestion. I now multiply by 1.5x during high traffic.Jito Bundle Bidding Wars
At peak times, builders demand 0.01 SOL+ tips. I implemented dynamic bidding:
const baseTip = 0.001;
const dynamicTip = baseTip * (1 + (failedBundlesCount * 0.2));
Final Thoughts
This system worked because of:
- Helius for sub-10ms data
- Jito for guaranteed execution
- Jupiter for optimal routing
The real challenge wasn't speed—it was reliability during Solana's outages. My next post will cover failover systems when RPC nodes go down.
(Code examples are simplified—DM me on Twitter @YourHandle for the full repo.)
🚀 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)