DEV Community

Apollo
Apollo

Posted on

I Sniped a Solana Token in 400ms — Here's the Full Tech Stack

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 successful snipe 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—complete with real code examples and hard numbers.

The Challenge: Speed Is Everything

On Solana, new tokens can pump 1000x in seconds. To compete with professional MEV bots, I needed:

  • Sub-500ms execution (from detecting mint to confirmed tx)
  • Atomic arbitrage (buy + sell in one tx)
  • Reliable RPC (no missed blocks)

The Stack That Made It Possible

1. Jito MEV Bundles (The Speed Hack)

Jito bundles let you submit multiple transactions atomically, guaranteeing execution order. This is critical for sniping—your buy must execute before others.

from solders.keypair import Keypair  
from jito_protos.bundle_pb2 import Bundle  

# Create a bundle with buy + sell  
bundle = Bundle(  
    transactions=[buy_tx, sell_tx],  
    blockhash=latest_blockhash  
)  

# Submit via Jito searcher API  
jito_client.send_bundle(bundle)  
Enter fullscreen mode Exit fullscreen mode

Key Stats:

  • Median bundle execution time: 120ms
  • Success rate: 92% (vs. ~60% for vanilla txs)

2. Jupiter Swap API (Optimal Routing)

Jupiter aggregates all DEXs (Raydium, Orca, etc.) and finds the best route. I used their v6 API for instant quotes:

const quote = await fetch(  
  `https://quote-api.jup.ag/v6/quote?inputMint=SOL&outputMint=${newToken}&amount=0.1`  
);  

// Build swap transaction  
const { swapTransaction } = await (  
  await fetch('https://quote-api.jup.ag/v6/swap', {  
    method: 'POST',  
    headers: { 'Content-Type': 'application/json' },  
    body: JSON.stringify({ quoteResponse: quote }),  
  })  
).json();  
Enter fullscreen mode Exit fullscreen mode

Why This Matters:

  • Slippage control: Auto-routes to deepest liquidity pools
  • Gas efficiency: 30% cheaper than manual Raydium swaps

3. Helius RPC (Low Latency Data)

Public RPCs are too slow. Helius gave me:

  • WebSocket streams (0.5s faster than polling)
  • Enhanced APIs (e.g., getTokenAccounts in 80ms)
const heliusConnection = new Connection(  
  'https://mainnet.helius-rpc.com/?api-key=YOUR_KEY',  
  'confirmed'  
);  

// Listen for new tokens in real-time  
heliusConnection.onProgramAccountChange(  
  TOKEN_PROGRAM_ID,  
  (accountInfo) => {  
    if (isNewMemeToken(accountInfo)) {  
      snipeToken(accountInfo.mint);  
    }  
  }  
);  
Enter fullscreen mode Exit fullscreen mode

Performance Boost:

  • Block propagation: 300ms faster than public RPCs
  • 99.9% uptime (critical during high volatility)

The Full Snipe Sequence (400ms Breakdown)

  1. 0ms: Helius WebSocket detects new mint
  2. 50ms: Jupiter fetches optimal swap route
  3. 100ms: Bot signs buy + sell bundle
  4. 250ms: Jito submits bundle to next leader
  5. 400ms: Tx confirmed, profit secured

Lessons Learned the Hard Way

  • Use priority fees: Without them, my first 10 bundles were skipped.
  • Pre-warm connections: Helius RPCs need warm-up to avoid 200ms cold starts.
  • Test on devnet: I burned $500 in SOL before realizing my sell tx was failing.

Final Thoughts

This stack isn't just for sniping—it's a blueprint for any high-frequency Solana bot. The key was minimizing latency at every layer:

  1. Data (Helius)
  2. Routing (Jupiter)
  3. Execution (Jito)

If you're serious about MEV, start with these tools. The next meme coin could be yours.


🚀 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)