MEV and arbitrage: predatory but avoidable
Arbitrage at its simplest, is a strategy where an investor or entity buys and sells an asset in different markets, taking advantage of the difference in price between those two markets.
Popular in the world of TradFi, it’s a big part of the crypto ecosystem, too. But this isn’t the only form of exploitation of market inefficiencies.
MEV, or maximal extractable value, is a hidden tax on all types of Ethereum transactions.
That means any time you want to transact in DeFi: from buying or selling an NFT, lending tokens to a liquidity pool, or swapping one token for another, a group of opportunistic users known as “searchers” have the opportunity to see your trade, and manipulate the criteria surrounding your trade to ensure they make profit, at your expense.
In DeFi, MEV and arbitrage go hand in hand: they take advantage of price differences. In this post, we’ll explain the relationship between arbitrage and MEV, how traders are made vulnerable to them, and how you can keep yourself protected.
Arbitrage basics for the crypto market
Diving a bit deeper into the definition of arbitrage: the price of an asset varies depending on which exchange you are buying or selling it from. With more than 250 crypto exchanges, that means there’s a lot of opportunity for traders to make a profit from finding assets with different prices.
Why are prices higher or lower on different exchanges? The simple reason is demand. If one exchange has many buyers and not many sellers, the price will go up. While on another exchange, if there are lots of sellers but not many buyers, prices will fall.
But there are other reasons for price discrepancies.
Liquidity: Exchanges with higher trading volumes tend to have more stable prices, while lower-volume exchanges can experience more pronounced price swings.
Geography: Demand for specific cryptocurrencies can vary across regions, leading to price differences. So a typical example: USDC on an exchange based in Asia will have a fractionally different price on a European exchange.
Fiat Currency Differences: The use of different fiat currencies on different exchanges can also contribute to price discrepancies. Explaining this further, exchange rates for fiat currencies as well as where the buyer is in the world, create added variation in the price of an asset.
Market Fragmentation: As we touched on earlier, there are a lot of crypto exchanges, meaning there are more opportunities for arbitrage.
Let’s take a look at how arbitrage can take place using Ethereum as an asset.
Ethereum arbitrage
Ethereum is one of, if not, the most available crypto assets to buy. That means there are lots of opportunities to find price differences.
Below you can see a screenshot of the price of Ethereum across different exchanges.
Using the above example, a buyer looking to buy cheap and sell high would buy from Coinbase, where the price of Ethereum is $1,920.16, and then sell on DigiFinex, where the price is $1,934.41.
If the buyer bought 1 whole ETH, they would have made around $14 just by exploiting this difference in price - minus fees of course.
But this is just one type of arbitrage. In the next section we’ll look at other ways of exploiting price differences.
Common types of arbitrage in crypto
There are lots of different ways of exploiting arbitrage across crypto markets. Here are the most common:
-
Triangular arbitrage: price differences between three currencies on an exchange. This sounds complicated but in reality, it’s targeting three currencies that allow you to make a profit based on price differences between them. So for example, you hold USDC, and you use it to buy Bitcoin. You notice that a Bitcoin/Ethereum trading pair gives you more Ethereum than simply trading USDC/ETH, so you swap your Bitcoin for ETH. Lastly you convert the ETH back to USDC at a higher rate pocketing the difference.
-
Cross exchange: buying on one exchange and selling on another at a higher price. So this is the example we explained above.
-
Spatial: exploiting price differences across different locations. So as we mentioned earlier, different locations globally will have different prices based on supply and demand.
-
MEV: A slightly different type of arbitrage, MEV creates an artificial arbitrage opportunity by increasing or decreasing a token price around a single trade. We’ll explain this in more detail in the next section.
There are lots of other types of arbitrage that can take place in crypto, but for now we’re going to turn our attention to MEV.
How MEV exploits arbitrage opportunities
MEV or “maximal extractable value” is, as we explained earlier, a unique feature to the world of crypto. Whenever you make a trade, buy or sell an NFT, or lend tokens to a liquidity pool, people can see what you’re trading and take advantage.
To date, billions of dollars worth of value has been lost on Ethereum, making it problematic, particularly for new users. There are several key ways MEV can take place on Ethereum:
-
Frontrunning - Frontrunning occurs when an MEV bot monitors the mempool for a trader’s pending transaction. Spotting a potential trade, the bot quickly duplicates the users transaction so that they can be the one to get the tokens or the opportunity that the user detected.
-
Backrunning - When a trader places a large trade that artificially inflates the price of an asset on an AMM, an MEV bot can backrun the trade and profit from the arbitrage.
-
Sandwich attacks - Sandwich attacks occur when a user’s transaction gets trapped, or “sandwiched,” between two hostile transactions — one before and one after. As a result, the original transaction executes at a much higher price than necessary, leading to an inflated price for the original trader and a profit for the malicious trader placing the two extra trades.
For all of these types of MEV, speed is vitally important. That’s because the length of time a pending transaction remains in the mempool can be seconds.
That means searchers often rely on bots to execute MEV attacks.
Most DEXs are vulnerable to MEV arbitrage
MEV is possible because validators are free to order blockchain transactions as they see fit in order to maximize their profits. Proof-of-stake (PoS) blockchains such as Ethereum use parties known as “validators” in order to ensure that the consensus rules of the blockchain are followed by all participants.
Validators get randomly selected to add the next block to the blockchain. In this process, they determine what transactions are included in the block, and in what order.
When you submit a transaction on Ethereum, it does not immediately get added to the next block. Instead, it first goes into the “mempool” which is the collection of all pending transactions. Validators then pull transactions from the mempool and add them to the next block when it’s time for it to be built.
Here is where the opportunity to extract value through MEV comes in.
Validators are not required to add transactions to the block in the same order that they were submitted by users, so searchers can pay validators a fee to order transactions in a specific way. For example, they can pay to have their transactions come first if they want to frontrun someone else, or they can pay to have their transactions come right after a specific transaction if they want to perform a backrun — both are types of MEV.
But while MEV is common place, it’s not impossible to avoid.
Traders can protect themselves with MEV blockers and defensive measures, but MEV is still a threat on most DEXs.
Let’s take a look at how it works.
Frontrunning
Here’s a simplified look at how frontrunning works.
-
Monitoring Pending Transactions: A bot monitors the mempool looking for a pending transaction it can create an arbitrage opportunity. It finds one: User A intends to swap 2 ETH for $BOB tokens
-
Selecting Profitable Transactions: The bot identifies this amount of ETH would create a significant impact on token price. This means there’s an opportunity for arbitrage: exploiting the difference between the pre-trade and post-trade states of the token being traded.
-
Placing A New Transaction: The bot submits its own transaction paying higher gas fees to be positioned before user A’s transaction in the block. As a result, user A received fewer tokens than they were hoping for. Meanwhile the bot has sold the tokens at an elevated price, earning itself a healthy margin in the process.
If you’re interested in understanding frontrunning more fully, check out our frontrunning blog post.
The bottom-line: consequences of MEV arbitrage
MEV is a controversial subject in the crypto space. While some argue it helps keep markets running more smoothly, CoW DAO takes the position that MEV is a bad thing.
Sophisticated actors familiar with the mechanics of blockchains like Ethereum have developed numerous ways to exploit users with less knowledge.
MEV makes money for searchers, block builders, and Ethereum validators at the expense of regular users, especially beginners who don’t know how to protect themselves. As of the time of writing, sandwich attacks on AMMs and aggregators alike generate almost $1 million in profit for searchers each week.
Over time, persistent MEV erodes market confidence as traders realize they are at a constant disadvantage to more sophisticated actors.
While in many parts of DeFi, arbitrage opportunities can feel inevitable, there are a few spots where MEV arbitrage can’t hurt your trades.
Meta-DEX aggregator solution to MEV exploitation
You’ll no doubt be familiar with a decentralized exchange, or DEX. These are the backbone of the DeFi world, acting as a bedrock underpinning all trades.
DEX aggregators meanwhile, bundle all the DEXes up into one platform to allow a user to search all the DEXes looking for the best price for their trade.
A Meta DEX Aggregator is different again. As the “meta” name implies, they aggregate DEX aggregators. This leads to better liquidity coverage across more venues, while still providing users with a single interface for their trades.
Why would you want to aggregate an aggregator? There are many reasons. The first is that DEX and DEX aggregators have strong points and weak points. Some are better for large trades, others for small trades, and some are better across certain trading pairs. There’s a good bit of research on the strengths and weaknesses of DEX aggregators here.
A meta DEX negates those weak points, by routing your trade to the DEX that is strong for the type of trade you’re trying to do. In essence, a Meta DEX takes the guesswork out of finding the right DEX for your trade.
Another key reason for a Meta DEX Aggregator is that it can integrate features not found on the DEXes themselves. Such as MEV protection: one of the baked in goodies found in CoW Swap.
We dive into that, and the other features of what makes CoW Swap so special.
The CoW Swap approach
CoW Swap was built from the ground up with MEV protection in mind.
CoW Swap relies on 3 main features to keep you safe from MEV:
-
Delegated Trade Execution - On CoW Swap, all transactions are routed through a decentralized network of “solvers” — independent algorithms that are responsible for finding the best execution price for your trades. That means those MEV bots we spoke about earlier can’t see your trades, and therefore, can’t arbitrage your profits away.
-
Coincidence of Wants - Any time you submit a trade on CoW Swap, solvers start looking for the best way to execute it. Before checking on-chain liquidity, solvers check other incoming orders on CoW Swap’s current batch auction to see if your trades can be matched peer-to-peer. If someone wants to do a trade in the opposite direction to what you want, you are paired together, and the whole thing is executed gas free!
-
Uniform Clearing Prices - On other DEXes, whenever a lot of people want to trade the same token, each of those trades are treated individually, meaning each trade is executed at a slightly different price. This allows MEV to creep in, as trades can be slotted in between that queue of swaps to make the most money. On CoW Swap, if the same people are making the same trade, as long as they are in the same batch auction, each order will be settled for the same clearing price when it goes on-chain. This leaves no room for MEV attacks since all prices are the same, meaning that transaction ordering becomes irrelevant.
Want to understand CoW Swap’s unique feature set more fully? Check out this blogs: