Tuesday, February 7, 2023

Join the club

top

Osmosis: A novel solution to the MEV problem

tl;dr Summary: The Maximal or Miner extractable value (MEV) problem in which miners falsify transactions has ballooned in the last year, which some call an existential crisis for Ethereum. A potential solution is currently under development in the Cosmos layer-1 ecosystem.

What is MEV?

MEV refers to the maximum reward or value that a miner (or a validator in proof-of-stake) can extract from the process of creating blocks by including, excluding, or changing the order of transactions in a block. This value is over and above the standard block reward and gas fee the miner receives.

Let us take an example to unpack this.

Tony wants to send some tokens to Bob. The transaction first goes to the node to which Tony is connected. From there it gets added to a collection of transactions called the ‘mempool.’ Miners and validators, who have access to the mempool, then take a bunch of transactions, order them and create a block that gets added to the blockchain. 

A miner with the help of searchers (programs that run complex algorithms on blockchain data to detect profitable MEV opportunities) can find a profitable transaction in this mempool and add a copy of the same transaction at the top of the list, for financial gains. 

For example, if Tony finds a lucrative arbitrage opportunity, a miner can create a fake copy of his transaction but with their own address and put that before Tony’s transaction in the block.

This may sound wrong but in reality, this is how financial markets have always worked. For decades traders have used various methods to game the system in order to find profitable trades. This is also the case with blockchain and decentralized finance as it relies on economically rational actors to ensure the usefulness and stability of their protocols. 

MEV can occur in different ways on a blockchain. Here are some prominent examples:

  1. DEX arbitrage: This is the simplest and the most competitive MEV opportunity available on the blockchain where a user can find a price difference for a token between two DEXes and proceed to buy at a lower price on one DEX and then sell it at a higher price on the second DEX all in one single transaction.
  2. Liquidations: This type of opportunity exists with lending protocols like Aave. In a lending transaction, a user puts up collateral against which they borrow other tokens up to a certain amount of this collateral.

    Since the price of assets and tokens fluctuates daily, a situation may arise when the value of the collateral goes down compared to the value of the assets borrowed, in which case their collateral is liquidated and paid back to the lenders.

    Searchers can scan the blockchain data for such opportunities and be the first to submit a liquidation request when they find one and get the liquidation reward.
  1. Sandwich trading: A searcher scans the mempool for high-value DEX transactions. For example, a user wants to buy 10000 UNI with DAI on Uniswap. Such a transaction will increase the value of UNI relative to DAI.

    When a searcher finds this transaction, it creates a new transaction to buy UNI at a cheaper price just before the user transaction and then a sell transaction right after the user transaction.  
  1. NFT MEV: MEV in the NFT space is not a common occurrence. However, since NFTs are also on the blockchain, they are prone to the same techniques used by searchers. For example, if there is a popular NFT drop about to happen, a searcher can create a transaction and put it ahead of everyone else in the queue or they can buy the entire collection in one transaction. Also, if an NFT is listed with the wrong price, a searcher can front-run other purchasers and grab it for cheap.

The problems with MEV

Sandwich trading can result in a bad user experience, especially for the sandwiched user. 

Also, agents compete with each other for their transactions to be included in the next block by progressively increasing their gas prices, resulting in network congestion and high gas prices for everyone else.

MEV extraction ballooned in early 2021. As DeFi grows and increases in popularity, MEV may soon outweigh the base Ethereum block reward, which some consider an existential threat to Ethereum.

According to Flashbots, the cumulative MEV extracted away by miners and searchers is $609 million and has grown significantly over time.

Source: https://explore.flashbots.net/

How does Osmosis address the MEV problem?

Osmosis is a DEX built on the Cosmos ecosystem, and it plans to include a mechanism in its architecture to tackle this growing problem of MEV.

Osmosis calls this mechanism ‘threshold cryptography.’ Trade details in all transactions will be encrypted before it hits the mempool, preventing any validators (since Osmosis is on a PoS chain) from prioritizing based on the trade value. Once the transactions are executed and finalized, the validators will be able to see the trade value.

The team at Osmosis is currently working on building the rails for threshold cryptography into its internals, among other big changes like superfluid staking and customizable pool parameters. They hope to release it to the public this year. 

The Ethereum ecosystem is currently researching a different approach called MEV reward smoothing. This approach aims to reduce the variance in validator rewards by keeping it uniform.

Both of these approaches may be successful in slowing the problem of MEV, though Osmosis seems to be the more immediately effective. Only time will tell!

Author

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Enroll now

Latest Articles