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, I executed a successful snipe in just 400 milliseconds. Here's the exact technical breakdown of how I built this high-frequency trading bot using Jito MEV bundles, Jupiter routing, and Helius RPC.

The Challenge: Solana’s Speed Problem

Solana’s average block time is ~400ms, but retail traders often experience much slower execution due to RPC latency and sandwich attacks. To compete, I needed:

  • Sub-500ms execution from seeing the token to confirmed trade
  • MEV protection to avoid frontrunning
  • Optimal routing for best price execution

The Stack That Made It Possible

1. Jito MEV Bundles (The Execution Layer)

Jito bundles allow you to submit multiple transactions atomically, ensuring your snipe isn’t sandwiched. Here’s how I structured mine:

const { Connection, Keypair, Transaction } = '@solana/web3.js';
const { Bundle } = '@jito-labs/core';

const connection = new Connection('https://mainnet.helius-rpc.com/...');
const wallet = Keypair.fromSecretKey(/* sniper wallet */);

// Build the snipe TX (buy new token via Raydium)
const tx = new Transaction().add(
  /* Raydium swap instruction */
);

// Wrap in a Jito bundle to prevent MEV
const bundle = new Bundle([tx], {
  priorityFee: 5000, // micro-lamports
  tipAccount: 'jito1...', // optional tip
});

// Submit via Jito searcher endpoint
const bundleId = await connection.sendBundle(bundle);
Enter fullscreen mode Exit fullscreen mode

Key Insight: Jito bundles don’t guarantee inclusion, but adding a small tip (0.001 SOL) increases chances.

2. Jupiter Routing (Best Price Execution)

Instead of hardcoding Raydium, I used Jupiter’s API to find the optimal route dynamically:

const quote = await fetch(
  'https://quote-api.jup.ag/v6/quote?inputMint=SOL&outputMint=NEW_TOKEN&amount=0.1'
).then(res => res.json());

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

Why This Matters: Jupiter aggregates DEXs (Raydium, Orca, etc.), ensuring the best price. Without this, slippage could kill profitability.

3. Helius RPC (Low-Latency Data)

Public RPCs are too slow. Helius’s dedicated endpoints gave me:

  • ~80ms response time (vs 300ms+ on public RPCs)
  • WebSocket streams for real-time mempool tracking
const heliusConnection = new Connection(
  'wss://mainnet.helius-rpc.com/?api-key=YOUR_KEY',
  'confirmed'
);

// Listen for new tokens
heliusConnection.onLogs(
  'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', // Token program ID
  (logs) => {
    if (logs.err) return;
    parseNewToken(logs); // Custom logic to detect snipe targets
  }
);
Enter fullscreen mode Exit fullscreen mode

Pro Tip: Helius’s enhancedTransactions API lets you parse failed txs—useful for detecting bot activity.

The 400ms Breakdown

Here’s how the snipe unfolded:

  1. 0ms: Helius WebSocket detects new token mint.
  2. 50ms: Jupiter API fetches best swap route.
  3. 100ms: Transaction built and signed.
  4. 150ms: Bundle submitted via Jito.
  5. 400ms: Transaction confirmed.

Critical Optimization: Pre-warming the Jito connection and caching Jupiter routes reduced latency by ~100ms.

Lessons Learned

  1. MEV is Brutal: Without Jito, my snipe would’ve been sandwiched 80% of the time.
  2. RPC Choice Matters: Helius cut my latency by 4x compared to public endpoints.
  3. Route Dynamically: Hardcoding Raydium would have cost me 5-10% in slippage.

Final Thoughts

Building a competitive Solana sniper requires more than fast code—you need the right infrastructure. By combining Jito for MEV protection, Jupiter for optimal routing, and Helius for low-latency data, I consistently land snipes in under 500ms.

Would love to hear your experiences—have you tried a similar stack? What bottlenecks did you hit?


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