I Sniped a Solana Token in 400ms — Here's the Full Tech Stack
Last week, I successfully sniped a Solana token launch in just 400 milliseconds. It was a thrilling experience, and I learned a ton about the Solana ecosystem, MEV (Miner Extractable Value), and how to optimize for speed. In this article, I’ll walk you through the full tech stack I used, focusing on Jito MEV bundles, Jupiter routing, and Helius RPC. I’ll also share some practical code snippets and lessons learned from the process.
The Goal: Sniping a Token Launch
Sniping a token launch on Solana involves buying a token immediately after it becomes available on a decentralized exchange (DEX) like Raydium or Orca. The faster you can execute the transaction, the better your chances of getting in early before the price skyrockets. In my case, the entire process—from detecting the token listing to executing the trade—took just 400ms.
The Tech Stack
1. Jito MEV Bundles: Frontrunning with Precision
Jito is a Solana-specific MEV infrastructure provider that allows you to submit bundles—groups of transactions that are executed atomically and in sequence. This is crucial for sniping, as it ensures your transactions are prioritized by the validator.
How I Used Jito
I used Jito’s bundle system to frontrun other traders by submitting my buy transaction as part of a bundle. Here’s how I structured it:
const jitoBundle = {
transactions: [
// Wrap SOL to WSOL
{
instructions: [wrapSOLInstruction],
signers: [myWallet],
},
// Buy token
{
instructions: [buyTokenInstruction],
signers: [myWallet],
},
],
priorityFee: 0.001, // Set a higher fee to incentivize validators
};
I sent this bundle to Jito’s endpoint using a simple HTTP POST request:
const response = await fetch('https://jito.solana.com/bundle', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(jitoBundle),
});
Key Lesson: Bundles are not guaranteed to be executed, so I ensured my transaction had a higher priority fee (0.001 SOL) to make it attractive to validators.
2. Jupiter Routing: Optimizing the Swap
Jupiter is a Solana DEX aggregator that provides optimal routing paths for trades. Instead of directly interacting with Raydium or Orca, I used Jupiter’s API to find the best route for my swap.
Fetching the Best Route
Here’s how I fetched the best route for swapping SOL to the new token:
const url = `https://quote-api.jup.ag/v1/quote?inputMint=So11111111111111111111111111111111111111112&outputMint=${newTokenMint}&amount=1&slippage=0.5`;
const response = await fetch(url);
const route = await response.json();
The route object included details like the expected output amount, slippage, and the exchange path.
Executing the Swap
Once I had the route, I used Jupiter’s API to create and execute the swap transaction:
const swapTransaction = await Jupiter.createSwapTransaction({
route,
userPublicKey: myWallet.publicKey,
});
const signedTransaction = await myWallet.signTransaction(swapTransaction);
const txid = await connection.sendRawTransaction(signedTransaction.serialize());
Key Lesson: Jupiter’s routing engine saved me time by automatically selecting the best DEX and minimizing slippage.
3. Helius RPC: Low-Latency Communication
Helius is a high-performance RPC provider for Solana. I used Helius to minimize latency when interacting with the Solana blockchain, which was critical for sniping.
Connecting to Helius
Here’s how I connected to Helius’s RPC endpoint:
const connection = new Connection('https://api.helius.xyz/rpc', 'confirmed');
Helius’s endpoint consistently provided sub-100ms response times, which was essential for detecting token listings and executing trades quickly.
Monitoring Token Listings
To detect the token launch, I used Helius’s event streaming API:
const subscription = connection.onProgramAccountChange(
new PublicKey('RAYDIUM_PROGRAM_ID'),
(accountInfo) => {
const tokenAccount = TokenAccountLayout.decode(accountInfo.data);
if (tokenAccount.mint === newTokenMint) {
// Token detected—execute snipe
executeSnipe();
}
},
);
Key Lesson: Helius’s low-latency RPC was a game-changer, allowing me to react to events faster than a standard Solana RPC node.
The Snipe in Action
Here’s a breakdown of the 400ms snipe timeline:
- 0ms: Detected the token listing via Helius’s event stream.
- 50ms: Fetched the optimal swap route using Jupiter.
- 150ms: Constructed and signed the transaction.
- 300ms: Submitted the transaction bundle via Jito.
- 400ms: Transaction confirmed on-chain.
Lessons Learned
- MEV is Competitive: Speed is everything. I tested my stack extensively beforehand to ensure everything worked seamlessly.
- Fees Matter: Setting a higher priority fee increased my chances of success.
- Monitoring is Key: Real-time event monitoring via Helius was crucial for detecting the token launch instantly.
Conclusion
Sniping a Solana token in 400ms required a combination of speed, precision, and the right tools. By leveraging Jito’s MEV bundles, Jupiter’s routing, and Helius’s low-latency RPC, I was able to execute the trade before most other traders even knew the token existed. This experience deepened my understanding of Solana’s ecosystem and the importance of optimizing every aspect of the transaction pipeline.
🚀 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)