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 perfect snipe in just 400ms from block inclusion to confirmation. 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 optimizations.

The Challenge: Why 400ms Matters

Solana's 400ms block times mean traditional Ethereum-style MEV strategies won't cut it. You need:

  • Sub-block latency (execution must finish before the next slot)
  • Precise bundle construction (Jito bundles require exact simulation)
  • Optimal routing (Jupiter's on-the-fly swap calculations)

Tech Stack Breakdown

1. Jito MEV Bundles (The Execution Layer)

Jito bundles let you guarantee transaction order by paying validators directly. Unlike Ethereum, where you compete in the public mempool, Solana bundles are private until inclusion.

Key Components:

  • Bundle Construction: Transactions must be pre-signed and ordered correctly.
  • Priority Fees: Jito validators prioritize bundles with higher tips.
import { Connection, Keypair, Transaction } from "@solana/web3.js";
import { Bundle } from "@jito-labs/core";

const jitoEndpoint = "https://mainnet.jito.wtf";
const connection = new Connection(jitoEndpoint);
const keypair = Keypair.generate();

// Build a bundle with 3 transactions (sniping sequence)
const bundle = new Bundle([
  tx1, // Initial swap (Jupiter)
  tx2, // Liquidity removal
  tx3, // Profit-taking transfer
]);

// Submit with a 0.01 SOL tip for priority
await connection.sendBundle(bundle, { priorityFee: 10000000 });
Enter fullscreen mode Exit fullscreen mode

Lesson Learned:

  • Bundles fail if any transaction reverts. Always pre-simulate.
  • Tip at least 0.005 SOL to ensure inclusion.

2. Jupiter Routing (The Swap Engine)

Jupiter's API provides optimized routes for minimal slippage. Since new tokens often have volatile liquidity pools, we need dynamic routing.

Key Optimizations:

  • Route Caching: Pre-fetch possible routes before the token drops.
  • Slippage Control: Set aggressive (but safe) slippage (I used 5%).
import { Jupiter, RouteInfo } from "@jup-ag/core";

const jupiter = new Jupiter(connection, { enforceSingleTx: true });

// Fetch best route (USDC -> NewToken)
const routes = await jupiter.computeRoutes({
  inputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
  outputMint: NEW_TOKEN_MINT,
  amount: 100_000000, // 100 USDC
  slippage: 5, // 5%
});

// Execute the swap
const { tx } = await jupiter.exchange({ route: routes[0] });
await sendTransaction(tx);
Enter fullscreen mode Exit fullscreen mode

Lesson Learned:

  • Single-transaction mode (enforceSingleTx) is critical—multi-tx swaps fail under congestion.
  • Route caching reduces latency—fetch routes before the token launches.

3. Helius RPC (The Speed Advantage)

Public RPCs are too slow. Helius provides:

  • Dedicated endpoints (sub-50ms response times)
  • WebSocket streams (real-time block updates)
const heliusRpc = "https://mainnet.helius-rpc.com/?api-key=YOUR_KEY";
const wsConnection = new Connection(heliusRpc, {
  wsEndpoint: "wss://mainnet.helius-rpc.com/ws",
});

// Listen for new blocks (critical for sniping)
wsConnection.onSlotUpdate((slotUpdate) => {
  if (slotUpdate.type === "completed") {
    executeSnipe(); // React immediately
  }
});
Enter fullscreen mode Exit fullscreen mode

Lesson Learned:

  • WebSocket > Polling—reduces latency from ~500ms to ~100ms.
  • Batch requests—Helius handles parallel JSON-RPC calls efficiently.

The Full Snipe Sequence (400ms Breakdown)

  1. 0ms: Helius WebSocket detects new block.
  2. 50ms: Jupiter route fetched.
  3. 100ms: Bundle constructed and simulated.
  4. 200ms: Bundle submitted via Jito.
  5. 400ms: Block confirmed—profit secured.

Conclusion

Sniping on Solana requires sub-block execution speed, Jito's private bundles, Jupiter's optimized swaps, and Helius's low-latency RPC. The difference between success and failure is often <100ms.

If you're serious about MEV on Solana, master these tools—because the next snipe 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)