I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
Last week I successfully frontran a trending Solana token launch by 400 milliseconds using a custom MEV bot. In this post, I'll break down the exact technical stack that made this possible, including Jito MEV bundles, Jupiter's swap API, and Helius RPC optimizations.
The MEV Landscape on Solana
Solana's MEV (Maximal Extractable Value) game differs significantly from Ethereum. With 400ms block times and parallel execution, the strategies require different approaches:
- No mempool (transactions hit the chain directly)
- Bundle-based MEV through Jito
- Priority fee bidding wars
- Need for sub-second latency
Core Components of the Stack
1. Jito MEV Bundle Construction
Jito's bundle system allows you to submit multiple transactions that execute atomically. Here's how I constructed my snipe bundle:
from solders.keypair import Keypair
from jito_protos.bundle_pb2 import Bundle
def create_snipe_bundle(
mint_address: str,
buy_amount: float,
priority_fee: int
) -> Bundle:
# 1. Create setup transactions (ATA creation, etc)
setup_txs = create_setup_transactions(mint_address)
# 2. Create the actual swap transaction
swap_tx = create_jupiter_swap_tx(
input_mint="So11111111111111111111111111111111111111112", # SOL
output_mint=mint_address,
amount=buy_amount,
slippage=0.5, # Aggressive for sniping
priority_fee=priority_fee
)
# 3. Bundle them together
return Bundle(
transactions=[setup_txs, swap_tx],
blockhash=recent_blockhash,
priority_fee=priority_fee
)
Key parameters I optimized:
- Priority fees: Started with 10M lamports (~0.1 SOL) and dynamically adjusted
- Bundle ordering: Setup transactions must come before swap
- Blockhash freshness: Updated every 100ms
2. Jupiter Swap API Integration
Jupiter's swap API provided the most efficient routing. I used their v6 API with direct routes:
const jupiterQuote = await fetch('https://quote-api.jup.ag/v6/quote', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
inputMint: 'So111...11112',
outputMint: NEW_TOKEN_MINT,
amount: AMOUNT_IN_LAMPORTS,
slippageBps: 50, // 0.5%
onlyDirectRoutes: true, // Faster execution
asLegacyTransaction: false // Versioned TX
})
});
Critical optimizations:
-
onlyDirectRoutes: Reduced API response time from 120ms → 40ms - Cached token list updates every 30 seconds
- Pre-warmed HTTP connections to their LB
3. Helius RPC Configuration
Helius provided the fastest RPC endpoints with their specialized MEV cluster:
from solana.rpc.async_api import AsyncClient
HELIUS_MEV_URL = "https://mev-rpc.helius-rpc.com/?api-key=YOUR_KEY"
async def send_bundle(bundle: Bundle):
client = AsyncClient(HELIUS_MEV_URL)
return await client.send_bundle(bundle)
Performance metrics:
- Median latency: 85ms
- 99th percentile: 220ms
- Success rate: 98.7% over 10,000 requests
The Snipe Sequence
Here's the exact timeline of the successful snipe:
- Token detection: Found new token from on-chain DEX creation (0.5 SOL liquidity added)
- Bundle preparation: 120ms (ATA creation + swap TX)
- Jupiter quote: 45ms
- Bundle submission: 80ms
- Block inclusion: Next slot (400ms later)
Total time from detection to inclusion: ~400ms
Critical Lessons Learned
-
Blockhash Management:
- Blockhashes expire after ~2 slots (800ms)
- I implemented a websocket subscription to get new blockhashes immediately
Error Handling:
async def resilient_send(bundle, retries=3):
for i in range(retries):
try:
return await send_bundle(bundle)
except Exception as e:
if "BlockhashNotFound" in str(e):
await update_blockhash()
await asyncio.sleep(0.05 * (i + 1))
-
Gas Competition:
- Saw competitors bidding up to 0.5 SOL per transaction
- Implemented dynamic fee adjustment based on recent block patterns
-
ATA Pre-creation:
- For really competitive snipes, I now pre-create ATAs for trending token symbols
Hardware and Infrastructure
-
Server: c7i.2xlarge (Ice Lake, 3.5GHz) in us-west-2
- 8 vCPUs
- 16GB RAM
- 10Gbps network
- Network: Dedicated connection with <1ms latency to Helius endpoints
-
Monitoring: Custom Prometheus dashboard tracking:
- Bundle submission latency
- Priority fee effectiveness
- Jupiter API response times
Final Thoughts
Winning at Solana MEV requires optimizing every millisecond of the pipeline. The key differentiators in my setup were:
- Using Jito bundles for atomic execution
- Helius's MEV-optimized RPC nodes
- Jupiter's direct routes with pre-warmed connections
- Aggressive blockhash management
The Solana MEV space is evolving rapidly — what worked last week might not work next week. Continuous adaptation and measurement are essential. I'm currently experimenting with SIMD-accelerated signature verification to shave off another 20-30ms from the pipeline.
Would love to hear what optimizations others are using in their setups!
🚀 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)