Cointime

Download App
iOS & Android

How MEV Is Preventing You From Making Profitable Trades

What is MEV?

MEV (maximal extractable value) is the highest possible value that can be obtained from mining a block, beyond the standard reward for mining and fees for processing transactions. This value can be obtained by including, excluding, or rearranging certain transactions within the block.

MEV is obtained by including, excluding, or rearranging transactions within a block.

MEV was originally coined in the context of proof-of-work (PoW) blockchain networks, where miners are responsible for adding transactions to the blockchain. In these networks, MEV referred to the value that miners could extract by including, excluding, or rearranging transactions within a block.

However, the Ethereum network has since transitioned from PoW to proof-of-stake (PoS), and mining is no longer part of the protocol. In PoS networks, validators rather than miners are responsible for adding transactions to the blockchain. Despite this change, the value extraction methods associated with MEV still exist, so the term is still used to refer to the value that can be extracted from the Ethereum network. However, the term “maximal extractable value” is now used instead of “miner extractable value” to reflect the fact that mining is no longer part of the process.

How does MEV affect transactions?

Validators are incentivized to adding transactions to the blockchain that adds up to the highest profitable MEV for the block they propose because this allows them to earn a higher reward for their work of proposing a block.

When independent network participants known as “searchers” use algorithms and bots to identify profitable MEV opportunities in the mempool, the list of transactions that are not yet included in a block, they submit a higher priority fee than their target transaction to ensure that the searcher’s transaction is submitted in accordance with their opportunity.

Let’s discuss what we mean by this MEV opportunity and how MEV is extracted to exploit your innocent transactions below.

How is MEV being exploited to attack your transactions?

Front-running

Front-running happens when a searcher identifies a potentially profitable transaction in the mempool, such as am arbitrage opportunity or a large transaction, and quickly executes a similar transaction with a higher fee. This transaction is more likely to be processed by the network first, allowing the miner to effectively steal the victim’s profits.

In short, you have worked hard to find a lucrative trade opportunity. But just as you are about to complete the transaction, an attacker swoops in and steals it by paying a higher gas fee to have their transaction processed before yours. This is like a seagull snatching a hot dog out of your hand just as you were about to take a bite. You are left feeling upset and defeated.

Sandwich Attack

In a sandwich attack, a searcher will monitor the mempool for large decentralized exchange trades to “sandwich” transactions.

As an example, if an individual wants to purchase 2,000 ETH with DAI on Uniswap, a trade of this size could significantly impact the ETH/DAI pair, potentially causing the price of ETH to significantly increase relative to DAI.

A searcher can determine the estimated price change that this large trade will have on the ETH/DAI pair and place a buy order just before the large trade. This allows the searcher to purchase ETH at the current price. Wait for the large trade to drive up the price, then execute a sell order immediately following the large trade, taking advantage of the increased price.

The process can be described as follows:

  1. Someone sees that you have made a deal to buy a large quantity of sandwiches at the current market price.
  2. They beat you to the punch and complete a similar deal to buy sandwiches at the market price.
  3. The increased demand for sandwiches due to the searcher’s deal causes a shortage (lower liquidity), driving up the price of sandwiches.
  4. Your deal is then completed at a higher price than you anticipated (higher slippage).
  5. The searcher then immediately resells the sandwiches for a higher price than they paid.

Back-running

Back-running refers to an attack where the searcher attempts to have their transaction processed immediately after a specific, unconfirmed “target transaction.”

For instance, a back-running bot might monitor the Ethereum mempool for new pairs being created on Uniswap. If the bot detects a new pair, it will place a buy transaction directly after the initial liquidity. The bot will then attempt to purchase as many tokens as possible (leaving some available for other traders), before waiting for the price to rise as other traders buy the token from Uniswap. The bot can then sell the tokens at a higher price. The success of this strategy depends on being the first to buy the tokens, but only after the token has been officially launched.

Back-runners can be seen as scalpers or resellers that quickly purchase large quantities of a newly released product, causing a shortage and driving up the price. They then sell the product at a higher price, profiting from the shortage they created.

So how can we protect ourselves from searchers exploiting MEV to hurt our trades?

The Salmonella Contract

The Salmonella contract is designed to lure and deceive front-running traders through the use of a decoy ERC-20 token and a misleading transfer function. If a transaction meets certain criteria (such as not being on a whitelist or initiated by the contract owner), the transfer function will only transfer a portion of the purchased amount to the front-runner. Other smart contracts have been created that impose a transaction tax specifically on known front-runners.

Liquidity Sniper Trap

In a Liquidity Sniper Trap is when the token contract has built-in code that can identify when a back-runner attempts to acquire the initial liquidity from a new decentralized exchange pair that includes the associated token. The back-runner is then added to a blacklist and prevented from selling their tokens. This restriction may be lifted at a later time.

Private mempool, “Dark pools”

Typically, transactions are broadcast to the mempool where they remain pending until validators pick them and add to the block. Private transactions however, are only visible to the pool and are not broadcast to other nodes. Private transactions usually come with a fee for the user, and may have their own rules and restrictions into which type of transaction can be included into their private pool.

We will discuss dark pools in more detail in the next part of these series, so if you haven’t, follow my account on Medium to learn more.

In conclusion:

I think none other than Dan Robinson and Georgios Konstantopoulos summarized what actually goes on in the short but decisive moment that happens between you submitting your transaction, and when it is published in a block to be immortalized for the world and future generation to verify in the post, Ethereum is a Dark Forest.

This article was written in 2020, and 3 years later and with Ethereum transitioning from proof-of-work to proof-of-stake the MEV exploitation problem has not been solved and MEV has become a bigger problem that I think is not addressed as much as it should by the community.

I understand why MEV exists, and does seem essential to incentivize validators, and to offer users the opportunity to prioritize their transaction by paying a higher fee. However, condoning or encouraging specific users to be able to hurt other users by paying another fee is not beneficial for the health of the network or the broader crypto community in general, and solutions to this problem is necessary.

Please stay tuned for the next piece in this series where I dive deeper into topics related to MEV.

https://coinsbench.com/how-mev-is-preventing-you-from-making-profitable-trades-a9692698b08a

Comments

All Comments

Recommended for you