📣 Creators, Exciting News!
Gate Square Certified Creator Application Is Now Live!
How to apply:
1️⃣ Open App → Tap [Square] at the bottom → Click your avatar in the top right
2️⃣ Tap [Get Certified] under your avatar
3️⃣ Once approved, you’ll get an exclusive verified badge that highlights your credibility and expertise!
Note: You need to update App to version 7.25.0 or above to apply.
The application channel is now open to KOLs, project teams, media, and business partners!
Super low threshold, just 500 followers + active posting to apply!
At Gate Square, everyone can be a community leader! �
What is MEV and how to protect your Solana transactions?
Written by: QuickNode, ChainNews Community
For developers building DeFi applications and trading bots on Solana, understanding MEV (Maximal Extractable Value) is crucial. MEV may impact the execution of user transactions, or threaten the profitability of your own bot. Higher costs, lower profits, and network friction are common consequences of unprotected MEV risks. This guide covers the basics of MEV on Solana, including transaction process mechanisms, common MEV types, and the increasing risks for developers building on the network. You will learn key strategies to mitigate the negative impact of MEV and protect your trades from interference.
Recommended prerequisite knowledge
Introduction to MEV on Solana
The Maximum Extractable Value (MEV) refers to the maximum value extracted from user transactions by rearranging, including, or excluding them. In proof-of-stake networks like Solana, validators as block producers have the ability to decide which transactions go into a block and in what order. This means that malicious or profit-seeking block producers can reorder transactions (or insert their own) to capture arbitrage profits, front-run user transactions, or exploit the order of transactions in various ways. Despite Solana not having a public mempool like Ethereum, MEV still exists—often through direct node connections, private mempools, or other specialized infrastructure.
For developers building trading bots or decentralized exchanges (DEX), not considering MEV may lead to:
In 2024, the DeFi activity on Solana is booming, and at the same time, MEV is also growing. Messari shows the real economic value of Solana (fees + MEV) growing over time:
Source: Messari: Solana Status - 4th Quarter of 2024
Although most MEVs are relatively small, there are countless examples of extracting tens of thousands of dollars from transactions (see the screenshot below), and even cases of million-dollar transactions.
Source: Jito - Arbitrage Explorer
For developers building DeFi applications and trading bots on Solana, understanding MEV is crucial. MEV may impact the execution of user transactions (resulting in unexpected slippage or transaction failures), and even affect the profitability of your own bot if competitors can intercept or reorder your transactions. Let’s review some basic knowledge about the Solana transaction process, examine common MEV types on Solana, and discuss measures you can take to protect your trades from MEV impact.
Solana Trading Process
The trading process of Solana has some key differences from Ethereum, which affects the performance of MEV:
Common MEV Types on Solana
Here are the most common types of MEV that Solana developers should be aware of:
Arbitrage
Arbitrage is one of the most common forms of MEV on Solana. Arbitrage typically involves buying and selling the same asset across multiple exchanges in an atomic manner. Arbitrageurs buy on the cheaper market and sell on the more expensive one, pocketing the price difference, for example:
Due to Solana’s ability to combine multiple instructions into one transaction, traders often perform atomic Arbitrage (two stages in one transaction) to ensure that the transaction is actually risk-free. A failed transaction will result in the buyer losing their priority fee, so they need to balance the size of the opportunity with the priority fee market.
The Arbitrage competition of Solana is very intense - bots spam numerous trades attempting to Arbitrage. The low fees of Solana mean that bots can execute a large number of Arbitrage trades; even if most fail or are unprofitable, occasional successes can be lucrative. In fact, over 50% of Solana trades are actually failed Arbitrage attempts (spam) - bots blindly attempt to capture price differences (see: Solana MEV - Introduction). While this may be a problem of network congestion, it generally means that prices can be kept in balance across various DeFi platforms.
Sandwich Attack
Sandwich attack is a classic form of negative MEV strategy, which also occurs on Solana. In a sandwich attack, the victim’s transaction is sandwiched between the attacker’s transactions: one executed before the victim’s transaction, and the other after. Suppose a user submits a large-scale coin exchange on a DEX; a MEV searcher familiar with this pending exchange can quickly submit their own transaction to purchase the same asset before the user’s transaction (driving up the price), then allow the user’s large purchase to be executed at the now higher price, and finally immediately sell the asset to profit from the difference. The attacker profits from buying at a low price and selling at a higher price, while the victim receives a worse price in their exchange (higher slippage).
As a developer or trader, you should be aware that if a third party can observe it before your exchange is finalized, they may try to sandwich it. User-set high slippage tolerance makes them particularly vulnerable - if users allow up to 5% slippage, sandwich robots can take advantage of most of the range to profit. Reducing slippage and sandwich risk involves slippage, privacy, and order control.
Clearing
Liquidation is another important MEV opportunity, especially in Solana’s DeFi lending protocols (e.g., Marginfi, Kamino, Save, etc.). When the collateral value of a borrower falls below the required ratio (i.e., their loan is under-collateralized), the position is liquidated. Liquidators (typically bots) can repay a portion or all of the loan on behalf of the borrower and receive some discounted collateral. This essentially brings profit to the liquidators, as they buy the collateral at a price lower than the market value.
MEV search robots continuously scan on-chain state and oracle price data to detect positions on the verge of liquidation. When they find one, they race to send liquidation transactions to seize the bonus. In Solana, due to the absence of a public mempool, liquidation robots ensure prompt awareness of on-chain changes (such as oracle price drops or health factor crossing thresholds), and then immediately send the liquidation transaction to the current leader. If multiple robots attempt to liquidate the same account, only the first transaction successfully included in a block will receive the reward, while others will fail. Liquidation is considered a fundamental guarantee of protocol health (preventing bad debts).
Jito Bundles & Other MEV Apps
Solana’s MEV ecosystem is developing, and Jito Bundles plays an important role in the extraction (and potential mitigation) of MEV. Validators running the Jito-Solana client participate in the off-chain block building market. Searchers directly send bundled transactions (and associated fee payments) to these block builders, rather than through the normal Solana gossip network. Subsequently, block producers include the bundled package with the highest fee payment in the block, from which they earn fees. This system allows MEV searchers to privately execute Arbitrage, liquidation, and sandwiching strategies (their transactions are not public before being included), as long as they pay competitive fees to prioritize processing. As a result, this brings significant income to Solana validators. Currently, Solana’s malicious MEV primarily comes from privately operated memory pools.
Risks of MEV to Solana developers
MEV brings various risks and challenges to Solana developers, especially those building trading bots or DEX applications:
In short, MEV in Solana may lead to higher costs, lower profits, and network friction. Developers should be aware of these threats and consider taking measures to mitigate these risks, especially in applications where any transaction sequencing affects financial outcomes.
Protecting Trades from MEV Impact
There are many tools that can prevent or limit the negative impact of MEV on your trades and users. Each use case is unique, so not every tool is applicable to your case.
Summary
MEV is an important factor to consider when building on any blockchain, and Solana is no exception. We understand that Solana’s design changes the game, but MEV still appears through Arbitrage, liquidation, and sandwich attacks. As a developer of Solana DeFi tools, ignoring MEV may result in suboptimal trading outcomes for your app’s users, or your bots losing profits. The good news is, there are many tools to help you mitigate these issues, regain control of transaction ordering, and even capture MEV for yourself or your users.