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 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 Problem: Speed is Everything

On Solana, new token launches are won or lost in milliseconds. The key challenges:

  1. Latency: Your bot must react faster than competitors.
  2. Slippage: Poor routing means paying more than necessary.
  3. MEV (Maximal Extractable Value): Frontrunning bots will snipe your trades.

To solve this, I built a system that:

  • Detects new pools in <100ms
  • Calculates optimal routes via Jupiter API
  • Submits transactions via Jito MEV bundles (avoiding frontrunning)
  • Uses Helius RPC for ultra-low-latency data

Tech Stack Breakdown

1. Real-Time Pool Detection (Helius RPC + WebSocket)

Instead of polling, I used Helius’s WebSocket to detect new pools instantly:

const { WebSocket } = require('ws');
const ws = new WebSocket('wss://mainnet.helius-rpc.com/?api-key=YOUR_KEY');

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'accountSubscribe',
    params: [
      'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', // Token program ID
      { encoding: 'jsonParsed', commitment: 'confirmed' }
    ]
  }));
});

ws.on('message', (data) => {
  const parsed = JSON.parse(data);
  if (parsed.params?.result?.value?.data?.program === 'spl-token') {
    console.log('New token mint detected:', parsed.params.result.value.data.parsed.info.mint);
  }
});
Enter fullscreen mode Exit fullscreen mode

Why Helius?

  • ~50ms faster than public RPC endpoints
  • WebSocket support for real-time events
  • High request volume without rate-limiting

2. Optimal Trade Routing (Jupiter API)

Jupiter’s API finds the best path across Solana DEXs (Raydium, Orca, etc.). Here’s how I fetched routes:

const fetch = require('node-fetch');

async function getBestRoute(inputMint, outputMint, amount) {
  const response = await fetch(
    `https://quote-api.jup.ag/v6/quote?inputMint=${inputMint}&outputMint=${outputMint}&amount=${amount}&slippage=0.5`
  );
  const data = await response.json();
  return data;
}

// Example: Swap 1 SOL to new token
const route = await getBestRoute('So11111111111111111111111111111111111111112', 'NEW_TOKEN_MINT', 1_000_000_000);
console.log(route.outAmount); // Expected output amount
Enter fullscreen mode Exit fullscreen mode

Key optimizations:

  • Pre-cached routes for known token pairs
  • Slippage tuning (0.5% worked best for new launches)
  • Fallback routes in case of failed swaps

3. Submitting Trades with Jito MEV Bundles

Jito bundles let you submit transactions atomically, preventing frontrunning. Here’s how I used their SDK:

const { Bundle, JitoBundleClient } = require('@jito-labs/sdk');

const client = new JitoBundleClient('https://mainnet.jito.wtf', 'YOUR_API_KEY');

async function sendBundle(transactions) {
  const bundle = new Bundle(transactions, 5); // 5-block tip for priority
  const result = await client.sendBundle(bundle);
  return result;
}

// Example: Bundle a swap + transfer
const swapTx = /* ...serialized swap transaction... */;
const transferTx = /* ...serialized transfer (profit-taking)... */;
await sendBundle([swapTx, transferTx]);
Enter fullscreen mode Exit fullscreen mode

Why Jito?

  • Frontrunning protection: Bundles execute as a single unit
  • Priority fees: Higher chance of inclusion
  • 400ms execution: Faster than vanilla Solana transactions

Performance Benchmarks

Step Time (ms)
Pool detection (Helius) 90
Route fetch (Jupiter) 120
Bundle submission (Jito) 190
Total 400

Lessons Learned

  1. Pre-warm connections: Keep WebSocket/RPC connections alive.
  2. Test on devnet: Simulate snipe scenarios before mainnet.
  3. Monitor gas: High-priority bundles cost more but win more.

Final Thoughts

This stack (Helius + Jupiter + Jito) is the fastest way to snipe Solana tokens today. The key is minimizing latency at every step—whether it’s detecting pools, routing swaps, or submitting bundles.

If you're serious about MEV, I recommend:

  • Running your own RPC node for even lower latency
  • Experimenting with private mempools
  • Using GPU signing for faster transaction prep

Hope this helps you land your next snipe. Happy trading!


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