MEV Solutions in Cosmos - By Le Thang

Le THang covers MEV in Cosmos including good and bad MEV, examples, and how Osmosis, SEI and Skip approach it.

MEV Solutions in Cosmos - By Le Thang

Disclaimer - This is part of our outside perspective series. Curious Cosmonaut Research is not the author we are simply highlighting some good threads and perspectives on the Cosmos ecosystem with their permission. We also, therefore, do not guarantee their accuracy.

Author: Le Thang

Source: Substack

Date: December 30, 2022

MEV Solutions in Cosmos

Dec 30, 2022

In this article, I will provide a simple breakdown of MEV and how some Cosmos projects like Osmosis, Skip Protocol, Mekatek, and Sei Network combat bad MEV. Let’s dive in!

1. What is MEV?

Maximal extractable value (MEV) is the maximal value that can be extracted from block production besides block reward and gas fees by reorganizing (including, excluding, and changing) the order of transactions in a block.

What does this even mean? Let’s go through some examples.

2. Good MEV & Bad MEV?

Good MEV examples:

  • DEX arbitrage: Someone can buy $Osmo tokens with a lower price on Juno and then sell it immediately on Osmo and pocket the difference. This ensures DEXes have the correct prices for the tokens.
  • Liquidations: Collaterals on lending protocols will be liquidated when they fall below certain collateralization ratios. Liquidators (searchers) will compete with each other to be the first ones to submit the liquidation transaction (MEV) and collect the liquidation fee. This ensures lenders get payback.

How about the bad one?

Bad MEV happens when someone read other people’s transactions and reorganizes them before they’re executed. This causes privacy breaches. Some examples are:

  • Sandwich attack & front-running: Suppose someone wants to buy 10000 $Atom with $USDC on Osmosis. The size of this trade would impact the price on Osmosis Zone by more than 1% due to slippage. A searcher can place a market buy order immediately before the large trade to buy Atom at a lower price (front-running) and sell it immediately after the large trade at a higher price caused by the large order ⇒ high slippage for users.
  • NFT MEV: searchers can front-run the buyers by placing a transaction in front of them and buying that NFT at a cheap price. This usually happens for NFT projects that use a first-come-first-served mechanism ⇒ Network congestion: high gas prices for everyone that use the blockchain at that period.
  • Validators reorganize blocks to capture MEV themselves ⇒ causing consensus instability.

3. Osmosis Approach

Osmosis use threshold decryption to solve bad MEVs such as sandwich attack or dark forest attack. This can be done because Osmosis is a sovereign chain. For good MEV, the Osmosis team is working with Skip protocol to build tools to internalize it.

What is threshold decryption?

Threshold decryption means transaction details are encrypted once they enter the mempool (a list of transactions waiting to be added to a new block) and hidden from validators when the block is proposed, and only get decrypted when validators agree on the ordering of transactions in the block.

⇒ This prevents validators from reorganizing the transactions’ order and also solves the latency problem since the block is only executed when it is finalized.

Flashobot tries to solve and reduce the side effects of MEV, such as high fees, the instability of consensus, and other problems, while Osmosis tries to solve the problems of MEV itself. - Sunny Aggarwal

4. Skip Protocol Approach

Transactions in Cosmos are executed as first-come-first-serve so it is very hard to run front-running or sandwich attacks. However, when there are arbitrage opportunities, everyone will spam transactions to capture that.

⇒ Wasted block space and network congestion.

What does Skip do?

Skip Protocol builds MEV capture mechanisms that redistribute “good” MEV to validators and stakers, while also protect users from “bad” MEV attacks such as sandwiching or frontrunning by:

  • Instead of spamming, searchers just need to send 1 transaction to Skip with their desired gas fees.
  • Searchers with the highest submitted gas fees will win the auctions and have their transactions executed.
  • Front-running and sandwich attacks are filtered out and only arbitraging is allowed.

Skip benefits:

  • Users with high staking rewards.
  • Validators with higher rewards & reputation.
  • Searchers with atomic & top-of-block execution.
  • Blockchain network by reducing spamming transactions.

5. Mekatek Approach

Instead of an on-chain auction approach like Skip protocol, Mekatek takes a different approach by leveraging off-chain searchers and aggregators. They find the arbitrage opportunities by looking at information from external systems such as CEX and bid to be the ones who execute the arbitrage.

6. Sei Network Approach

For good MEV, Sei is partnered with Skip protocol to capture good MEV and redistribute it to users, validators, and community pools.

For bad MEV, if users submit transactions through Skip relayer, Skip will eliminate frontrunning transactions and support end-to-end privacy for Sei users. In addition, Sei’s matching engine uses Frequent Batch Auctioning, which gives the same price for all market orders in the same block and prevents front-running.

Sei avoids using threshold encryption like Osmosis and protocol-controlled MEV since it will increase the protocol complexity (e.g. additional computation, bugs) and result in a lot of spam transactions which will increase block time and hardware requirements. Read more on this here:


Some extra reading

  1. On MEV by Eth foundation: link
  2. Osmosis’ threshold encryption vs SGX of flashbot: link.
  3. Interview with Sunny Aggarwal on why MEV will change Osmosis: link.
  4. Skip Protocol explained inlink.
  5. MEV in Solana and Jito labs solution: link.
  6. Ethereum is a Dark Forest by Paradigm: link.
  7. Analysis of bad MEV on Osmosis by Mekatek: link.

If you enjoy this please go subscribe to Le Thang’s newsletters