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 I first heard about traders front-running new token launches on Solana, I thought it was just hype. Then I built a sniper bot that landed a 5.3 SOL profit on a new token mint in just 400 milliseconds. Here's exactly how the tech stack works and what I learned building it.

The MEV Landscape on Solana

Solana's MEV (Maximal Extractable Value) game is fundamentally different from Ethereum. Instead of competing through gas fees, we're racing against:

  • Block times (400ms slots)
  • RPC latency
  • Jito's bundle auction system

The key components that made this work:

  1. Jito MEV Bundles - For guaranteed execution
  2. Jupiter Swap API - For optimal routing
  3. Helius RPC - For low-latency data
  4. Rust Program - For raw speed

Jito MEV Bundles: Your Execution Guarantee

Jito's bundle system lets you pay for priority execution. Here's why it's critical:

  • Regular transactions: 50-50% chance of landing in next block
  • Jito bundle: 99%+ chance when properly constructed

Here's how I construct bundles in Rust:

use jito_bundle::Bundle;
use solana_sdk::transaction::Transaction;

let mut bundle = Bundle::new();
let priority_fee = 500_000; // 0.5 SOL in lamports

// Add your snipe transaction
let snipe_tx = build_snipe_transaction();
bundle.add_transaction(snipe_tx);

// Set priority fee
bundle.set_priority_fee(priority_fee);

// Send to Jito searcher
let jito_endpoint = "https://jito-mainnet.helius-rpc.com";
let response = send_bundle(jito_endpoint, bundle).await;
Enter fullscreen mode Exit fullscreen mode

Key lessons:

  • 0.5-1 SOL priority fee is the sweet spot for new mints
  • Bundle submissions must arrive within first 100ms of slot
  • Always include a cancel instruction as last tx in bundle

Jupiter Swap API: Finding the Optimal Path

Trying to route through Raydium or Orca manually is too slow. Jupiter's API gives you:

  • Best price across all DEXs
  • Pre-simulated routes
  • Minimal compute units

Here's the API call I use:

use reqwest::Client;

let client = Client::new();
let response = client
    .post("https://quote-api.jup.ag/v6/quote")
    .json(&json!({
        "inputMint": "So11111111111111111111111111111111111111112", // SOL
        "outputMint": "NEW_TOKEN_MINT_ADDRESS",
        "amount": 1_000_000, // 1 SOL
        "slippageBps": 500, // 5%
        "onlyDirectRoutes": false
    }))
    .send()
    .await?;
Enter fullscreen mode Exit fullscreen mode

Critical parameters:

  • slippageBps: 500-1000 (5-10%) for volatile new mints
  • onlyDirectRoutes: false - Finds multi-hop arbitrage
  • Always request computeUnitPriceMicroLamports in response

Helius RPC: The Speed Advantage

After testing multiple RPCs, Helius consistently delivered:

  • 80-120ms response times vs 300ms+ for others
  • 99.9% uptime during high congestion
  • WebSocket streams for real-time updates

My connection setup:

use solana_client::nonblocking::rpc_client::RpcClient;

let rpc_url = "https://mainnet.helius-rpc.com/?api-key=YOUR_KEY";
let ws_url = "wss://mainnet.helius-rpc.com/?api-key=YOUR_KEY";

let rpc = RpcClient::new_with_commitment(
    rpc_url.to_string(),
    CommitmentConfig::confirmed()
);

// Listen for new blocks
let subscription = rpc
    .websocket()
    .subscribe_slot_updates()
    .await?;
Enter fullscreen mode Exit fullscreen mode

Pro tips:

  • Always use the same region for RPC and Jito submission
  • Request dedicated endpoints if doing >100 RPM
  • Monitor getRecentPerformanceSamples for latency spikes

The Full Snipe Sequence

Here's the exact timeline of my 400ms snipe:

  1. T-50ms: Token mint detected via Helius WebSocket
  2. T+0ms: Jupiter quote request initiated
  3. T+80ms: Jupiter response received
  4. T+120ms: Transaction built with priority fee
  5. T+150ms: Bundle submitted to Jito
  6. T+400ms: Transaction confirmed in block

The critical path was the 80ms Jupiter response. Without cached routes, this would have taken 300ms+.

Lessons Learned the Hard Way

  1. Failed snipes cost money: Each failed attempt burns 0.1-0.5 SOL in priority fees
  2. RPC selection matters more than code: Optimizing Rust saved 5ms, better RPC saved 200ms
  3. Not all bundles are equal: Adding too many transactions increases failure rate
  4. New mints ≠ free money: 60% of new tokens dump immediately post-snipe

The Complete Rust Sniper

Here's the core logic (simplified):

async fn snipe(new_mint: Pubkey, amount: u64) -> Result<Signature> {
    // Step 1: Get Jupiter quote
    let quote = get_jupiter_quote(new_mint, amount).await?;

    // Step 2: Build transaction
    let tx = build_swap_tx(
        quote,
        Keypair::new(), // Your wallet
        recent_blockhash,
    )?;

    // Step 3: Create Jito bundle
    let mut bundle = Bundle::new();
    bundle.add_transaction(tx);
    bundle.set_priority_fee(500_000);

    // Step 4: Submit
    let result = send_jito_bundle(bundle).await?;
    Ok(result.signature)
}
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

Building a profitable Solana sniper requires optimizing every millisecond:

  • Jito for execution certainty
  • Jupiter for optimal routing
  • Helius for real-time data
  • Rust for raw speed

The 400ms snipe wasn't luck—it was the result of carefully benchmarking each component. While the MEV opportunity is shrinking as more bots come online, the same tech stack works for arbitrage, liquidation bots, and other time-sensitive strategies.

Remember: this isn't free money. You'll burn SOL testing and optimizing before hitting consistent profits. But when you finally land that perfect snipe, seeing the transaction confirm before most traders even know the token exists? That's the magic of Solana's speed.


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