Imagine you’re about to make a big crypto trade on a decentralized exchange (DEX) on Solana. You think you’re getting a good deal. But suddenly, the price moves, and you get a worse price than you expected. This could be a ‘sandwich attack’.


What is a Sandwich Attack?
These attacks happen because Solana transactions are public before they are confirmed. Attackers, called ‘searchers’, can see your trade coming. They use bots to place their own trades around yours.
Here’s how it works:
- The attacker sees your trade (e.g., buying a token).
- They quickly buy the same token before your trade happens. This pushes the price up slightly.
- Your trade then executes at this slightly higher price.
- Immediately after, the attacker sells the token they just bought, profiting from the price increase caused by your trade and their own actions.
You end up paying more than you should. This is a form of Miner Extractable Value (MEV), where someone profits by reordering, inserting, or censoring transactions.
Why Solana is Susceptible
Solana’s high speed and low fees make it popular for DeFi. However, this also means many transactions are processed quickly, giving attackers a small window of opportunity. While Solana doesn’t have ‘miners’ like Ethereum used to, validators still process transactions, and MEV can still occur.
How to Protect Yourself
Protecting yourself from sandwich attacks requires understanding how they work and using tools that can help.
Use Private Transaction Services
Some services allow you to send your transactions privately. This means attackers can’t see your trade before it happens. Services like Jito and MEV Blocker offer solutions for this on Solana. They bundle your transaction with others and send it directly to validators, hiding it from public view until it’s confirmed.
Trade During Lower Activity Times
While not foolproof, trading when network activity is lower might reduce the chances of an attacker seeing and reacting to your trade in time. This is harder to time perfectly but can be a small factor.
Use DEXs with Built-in Protection
Some decentralized exchanges are starting to implement features to combat sandwich attacks. Look for DEXs that specifically mention MEV protection or private transaction routing. These platforms try to shield your trades from being exploited.
Be Aware of Slippage Settings
Slippage is the difference between the expected price of a trade and the price at which it’s actually executed. While setting a high slippage tolerance might seem like it gives you more room, it can actually make you a bigger target for sandwich attacks. Keep your slippage setting as low as possible while still allowing your trade to go through.
Consider Using Limit Orders
Some platforms offer limit orders, similar to traditional stock exchanges. With a limit order, you specify the maximum price you’re willing to pay. Your trade will only execute if the market reaches that price or better. This can help prevent unexpected price movements against you, though it doesn’t stop the attack entirely if the price moves unfavorably before your order is filled.
Staying safe in DeFi means being informed. By understanding sandwich attacks and taking these protective steps, you can trade more confidently on Solana.