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 new token $XYZ launched last week, I managed to snipe it in just 400ms using a custom MEV (Maximal Extractable Value) setup. Here's exactly how I built the system, the mistakes I made along the way, and the optimizations that got me sub-half-second execution.

The Core Components

  1. Jito MEV Bundles – For priority execution
  2. Jupiter Swap API – For optimal routing
  3. Helius RPC – For low-latency data
  4. Rust + Anchor – For on-chain logic
  5. Custom Frontrunning Bot – Written in TypeScript

1. Jito MEV Bundles: Bypassing the Queue

Jito’s bundles allow you to submit multiple transactions as an atomic unit, ensuring your snipe executes before others. The key is setting the right priority_fee and using Jito’s sendBundle endpoint.

use solana_sdk::pubkey::Pubkey;  
use jito_bundle::BundleBuilder;  

let bundle = BundleBuilder::new()  
    .add_transaction(my_snipe_tx)  
    .set_priority_fee(500_000) // 0.5 SOL in micro-lamports  
    .build();  

let response = jito_client.send_bundle(&bundle).await?;  
Enter fullscreen mode Exit fullscreen mode

Lesson Learned: Setting priority_fee too high burns unnecessary SOL. After testing, I found 0.5 SOL was the sweet spot for most new token launches.

2. Jupiter Swap API: Finding the Best Route

Jupiter’s API provides optimized swap routes, but you need to pre-fetch quotes and cache them. I used a polling loop with a 50ms interval to refresh quotes right before execution.

import { Jupiter, RouteInfo } from "@jup-ag/core";  

const jupiter = await Jupiter.load({  
  cluster: "mainnet-beta",  
  user: sniperWallet.publicKey,  
});  

const routes = await jupiter.computeRoutes({  
  inputMint: SOL.mint,  
  outputMint: XYZ_TOKEN.mint,  
  amount: 1 * 10 ** 9, // 1 SOL  
  slippage: 1, // 1%  
});  

const bestRoute = routes.routesInfos[0];  
Enter fullscreen mode Exit fullscreen mode

Pro Tip: Pre-warm Jupiter’s cache by requesting routes 5 seconds before launch. This avoids cold-start latency.

3. Helius RPC: Sub-100ms Block Updates

Helius’s RPC endpoints are optimized for speed. I used their WebSocket feed to listen for new blocks and pending transactions.

const heliusWs = new WebSocket("wss://mainnet.helius-rpc.com/?api-key=YOUR_KEY");  

heliusWs.on("message", (data) => {  
  const blockUpdate = JSON.parse(data);  
  if (blockUpdate.slot % 10 === 0) {  
    checkForNewToken(blockUpdate);  
  }  
});  
Enter fullscreen mode Exit fullscreen mode

Critical Optimization: Filtering every 10th block reduced false positives while keeping latency under 100ms.

The Full Snipe Workflow

  1. Token Detection – Watch Raydium/Creator wallets for new LP init.
  2. Route Pre-Warming – Cache Jupiter routes before TX.
  3. Bundle Submission – Send via Jito with 0.5 SOL priority.
  4. Confirmation – Use Helius to verify inclusion.

Common Pitfalls

  • Gas Estimation Errors – Always simulate bundles first.
  • RPC Throttling – Use multiple Helius endpoints for redundancy.
  • False Positives – Validate token metadata before sniping.

Final Thoughts

This setup consistently achieves 300-500ms execution. The biggest bottleneck? Wallet signing time—hardware wallets add ~200ms. For true edge, use a hot wallet with manual approval disabled.

Would you like a deep dive on any specific part? Let me know in the comments.


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