MEV for Dummies: Maximal Extractable Value Explained
MEV for Dummies: Maximal Extractable Value Explained

MEV for Dummies: Maximal Extractable Value Explained

MEV is the invisible tax every crypto investor pays—except for those collecting it. Here's what investors must know about maximum extractable value.

Crypto

Crypto

NFTs

NFTs

Technology

Technology

Blockchain promises a decentralized, transparent, and permissionless system that provides equal opportunity and value to all in the network. However, giving control to the miners hinders this promise because they can effectively charge an invisible tax to every crypto user that doesn't use their own node.

Miners who use MEV effectively can make money simply by prioritizing certain transactions over others. But what is MEV? How does it work? While this is a basic explanation, gaining a fundamental understanding is a little more complex, so buckle up.

What is MEV?

Maximal extractable value (also called "miner extractable value" or MEV) is a term coined in Flashbots 2.0 that refers to the opportunity blockchain miners and validators have to make extra money beyond just collecting block rewards and transaction fees.

MEV opportunities are generated when miners and validators are able to take advantage of the information they have access to, such as the order of transactions in the blockchain and the fees associated with them. This process is essentially the value that a miner can extract by moving user transactions around in a block. 

In 2014, Reddit user pmcgoohan predicted the use cases of MEVs when he noticed that Ethereum had an inherent flaw that allowed miners to rearrange transactions to make a profit. This was back when crypto users were unaware of miner extractable value. The Redditor explained the essence of MEV through an example:

While some may have labeled such profiteering as malicious, others simply see MEV as smart investment opportunities that could help you earn a quick buck if used correctly. The definition of MEV has expanded since users discovered new ways to extract value from the blockchain.

Maximal extractable value explained

To understand maximal extractable value (MEV) better, you must know how transactions are added to a blockchain. Whenever a transaction is signed, it moves to an unconfirmed state in a pool where miners can access them and add them to a block. Since blockchains are decentralized, the network itself (a collective of nodes) is responsible for validating transactions and adding them to the blockchain, and the balances on the ledger update accordingly.

Explain like I'm five

MEV stands for maximum extractable value, and it's a way for miners to make money by processing people's crypto transactions. Crypto traders make money using things like arbitrage bots, staking rewards, yield aggregators, lending, and HODLing. But there are also bad strategies that can cause many problems for users, like front-running and draining your wallet. Be careful when investing in MEV bots because they can be scams.

This can be understood by a simple example. If Alice wants to send 2 ETH to Bob, this transaction is added to a pool of unverified transactions that are subsequently verified by miners or validators. Once the transaction is validated, the record of this transaction is added to the blockchain, and the balances are updated to reflect -2 ETH for Alice and +2 ETH for Bob.

Different blockchains have different implementations for this model. Bitcoin uses proof of work as the algorithm to validate transactions, while Ethereum recently made the shift to proof of stake

Why do consensus mechanisms matter?

As discussed above, each blockchain uses an algorithm to validate transactions. This algorithm secures the network from unauthorized users adding transactions. A consensus algorithm is an agreement within a network that makes it decentralized. This model not only eliminates the need for a central party to control and authorize the circulation of value, but also removes the potential of single points of failure in the network.

These algorithms reward nodes that help secure a version of the ledger that's unanimously agreed upon by the entire network. Proof of work and proof of stake are the most commonly used frameworks for blockchain consensus, and these are where most MEV opportunities take place.

  • Proof of work—an algorithm that requires miners to solve a complex cryptographic puzzle to check the validity of a transaction. As the network grows, the puzzle becomes more difficult to solve. That's why a lot of computing power is required by miners to compete and earn the possibility to mine the next block. Bitcoin was the first blockchain to use this algorithm. 
  • Proof of stake—a sustainable algorithm that doesn’t require as much hardware and electricity to solve cryptographic puzzles. On the contrary, validators are nodes with a “stake” in the network by investing in the network’s native coin.
     

All transactions are held in a mempool, which is a public waiting area for unconfirmed transactions. The mempool is where miners select the transactions, order them, and add them to a block. It's also where miners found a loophole to profit from the algorithm in a way that wasn't intended. Essentially, MEV is economic value that the algorithm doesn't account for and can be captured by opportunistic miners.

How to make profitable transactions with MEV

Although miner extractable value opportunities seem exclusive to validators, independent network participants can also search for these opportunities using bots. Once these “searchers” have found the value extraction opportunity, they submit a transaction to the network with high gas fees to offer to the miners. This high gas fee is offered to put their transaction on priority so to capitalize on the profit-making opportunity that presents itself in the market. So, given the right resources, MEV can be utilized by any validator to order transactions as well.

MEV offers a few opportunities for validators and other network participants to make profits. Some of the opportunities are:

  1. DEX arbitrage: This is an opportunity when a trader buys a cryptocurrency at a lower price on one exchange and then quickly sells it at a higher price on another exchange. The difference in prices on decentralized exchanges creates profitable arbitrage opportunities.
  2. Lending protocol liquidations: These are profitable opportunities when someone takes out a loan using a lending protocol and then fails to repay it. Lenders are able to liquidate the borrower’s collateral at a profit, often greater than the loan amount.
  3. Front Running: Searchers use bots to scan the mempool for profitable transactions. These transactions are replicated and sent with a higher gas price so that it's prioritized over other transactions in the pool. 
  4. Sandwich trading: This is a way to manipulate the price of a currency in the market and make a profit off a user who’s trying to buy into a currency at market price. An MEV bot helps detect profitable MEV opportunities by spotting a large pending transaction on a DEX and placing a trade before and after to benefit from the price change. This transaction ordering helps make profits for MEV searchers but creates a negative experience for general users. 
  5. NFT MEV: The NFT market is extremely volatile, and traders make quick profits by buying NFTs in one instant and selling in another. The profit is generated from the difference in prices.
  6. Gas golfing: Programmers use gas golfing to reduce their transaction fees on the Ethereum network by optimizing the order of the transactions they’re making. This can be done by minimizing the amount of gas used in the transaction, thus creating a low-cost opportunity for the trader.

The pros and cons of miner extractable value

Miner extractable value opportunities can’t be generalized as all bad. There are good and bad consequences of these activities on a network.

MEV front running and sandwich attacks artificially inflate the value of assets and increase network congestion. This increases the gas required for the transaction and slows down the network by prioritizing trades over other transactions. Sandwich attacks also have a negative impact on the network because they can increase slippage and cause transaction execution issues. This results in a bad experience for traders on decentralized exchanges (DEX).

On the other hand, arbitrage helps regulate different bid-ask spreads of a currency across all exchanges. MEV arbitrage bots search for opportunities where the gap in prices of two exchanges is large enough to make a profit. You can capitalize on arbitrage by looking at the difference in exchange rates on popular platforms like Kraken or Public and collecting the difference.

DeFi lending protocols also rely on searchers to swiftly process liquidations so that lenders get paid back. This makes the lending process fast and efficient. Additionally, MEV brings in new revenue streams for miners, which can stabalize the network by sustaining miners in the event that mining rewards fall below breakeven. In other words, it creates an incentive for miners to secure the network that's uncorrelated with its built-in reward mechanisms.

What are flashloans?

Flashloans are uncollateralized loans that can be used to borrow huge amounts. The user is supposed to borrow and return the funds in the same transaction. If the user fails to return the amount before the transaction is fully executed, the smart contract cancels the whole transaction and returns the amount to the lender. Flashloans are instantaneous, so users need to find opportunities where they can take out the loan, make a profit, and pay the loan back all in the same transaction.

Floashloan's and miner extractable value

The Flash loan-MEV combo has helped create wealth out of thin air. The arbitrage bots find maximal extractable value opportunities and trigger the flash loan. Here’s how the process works:

  1. The MEV trader finds an arbitrage opportunity.
  2. The trader applies for a flash loan from a DeFi lending protocol like Aave or Dy/Dx.
  3. The trader creates a Logic by linking multiple transactions to an arbitrage opportunity. For example, if the trader finds an opportunity to make a profit by buying crypto on Uniswap and selling it instantly on Pancake, the Logic is created accordingly.
  4. The trader repays the loan and pockets the profit generated from capitalizing on the arbitrage opportunity. If the trader fails to repay the full amount, the smart contract cancels the whole transaction.

Flashloans are low-risk opportunities where users don't have to pay interest or fees. Aave and Dy/Dx have DeFi flash loan opportunities where users can borrow hundreds of thousands of dollars worth of crypto in a transaction without spending a penny. However, if the trade is successful, the lender gets a small share of the profit.

Where to get an MEV crypto bot

The crypto space has cultivated a new era of financial liberty and get-rich-quick schemes while also increasing the level of FOMO and greed among investors. This dynamic creates opportunities for scammers, especially since it's largely unregulated. No one shares the key to their passive income-generating treasure. If something sounds too good to be true, it probably is.

This is something all crypto investors should learn as soon as they get into the space. Crypto has a lot of opportunities to make decent profits, but it also has a dark side. Scammers have found creative ways to drain user wallets, and we’ve seen lots of losses in the name of bots that detect profitable MEV opportunities.

You might come across tweets and Reddit threads by social media influencers trying to clickbait you into buying their MEV front-running flash boats. More often than not, they have smart contracts that drain your wallet and send your funds to an unknown address.

Twitter user and Metamask engineer Harry.eth recently analyzed a case where a youtube scammer tried to steal the funds from users. Upon reverse engineering the bot, he found that the code triggered the transfer of funds from the user’s wallet to an unknown address, presumably the scammer's wallet.

It's highly recommended that anyone hoping to spot MEV opportunities codes the bot themselves or makes it with the help of a trusted developer. This would usually be someone who is familiar with the Solidity coding language and has experience working with Ethereum clients and validator nodes. Additionally, crypto fundamentals and the factors that affect crypto prices also are prerequisites to understanding the market.

How to detect profitable MEV opportunities

Some MEV opportunities hurt the crypto ecosystem, while others help make the processes more efficient. Currently, MEVs contribute to front running, sandwich attacks, network congestion, and transaction failures. This creates a lot of uncertainty and FUD (Fear, Uncertainty, and Doubt) in the market. Projects like Flashbots are working on mitigating the negative uses of MEVs. Other solutions include burning MEVs:

DeFi has brought lots of profitable opportunities for crypto traders. A good strategy that incorporates MEV arbitrage bots, staking rewards, yield aggregators, lending, and HODLing can definitely bear fruit in the long run.

MEV is an important concept for crypto investors as it can help them make more money through mining and validating transactions. While MEV can be beneficial to miners and validators, it can also be detrimental to regular users by increasing transaction costs and causing delays. Solutions such as Flashbots and proposer-builder separation are being developed to address these issues and make the blockchain more secure and efficient for all users.