๐งต
Millions of DeFi traders on public blockchains have been secretly taken advantage of over the past few years in a process called Miner Extractable Value
In this thread I'll explain what MEV is, how it works and how #SecretNetwork got rid of this problem
$SCRT$BUTT
๐
1/n
MEV is the term used for the (potential) profit that block producers (validators/miners who create new blocks) can make with specific behaviour
MEV is often considered into Good & Bad eventhough the result is profit for blockproducers over standard users
2/n
๐๐ฎ๐ฑ ๐ ๐๐ฉ, also(wrongly) dubbed frontrunning, consists in taking advantage of blockchain users by including, excluding or reordering txs inside a block and is performed by the block producers (both on PoW and PoS chains)
3/n
So what exactly are block producers taking advantage of?
Most of the MEV activity is related to AMM usage:
When you do a swap the price fluctuates and, in public blockchains, everyone can see it coming.
4/n
Ideally, benevolent validators would pick txs with higher fees first to take the bonus, and leave ones with lower fees waiting in the mempool.
Bad validators who take advantage of MEV sacrifice the fee bonus to put your tx on hold and profit from the movement
5/n
This is possible because block producers can chose the single txs to include in their block and in what order they should be performed
Therefore, once they see your swap waiting to be finalized, block prudcers can:
6/n
-calculate the price effect
-submit another tx (usually 2) to profit from the coming movement
-propose the next block including both txs in inverted order
As a result you will incur in unexpected slippage (your trade will be executed at a worse price)
7/n
Good MEV (aka ๐ฎ๐ฟ๐ฏ๐ถ๐๐ฟ๐ฎ๐ด๐ฒ) is the process of favouring liquidation and arbitrage txs, even if they're submitted by the block producer.
8/n
imo it canโt even be called MEV since:
- it happens after the block is final
- it doesnโt require for a txn reordering
- itโs needed to fill inefficiencies
9/n
Unlike arbitrage, bad MEV isnโt always 100% successful and its success rate depends on the time that the proposer has to:
- pick the txn from the mempool before others
- reorder txs before the block gets validated (~6 seconds on Secret)
10/n
Cross-chain MEV is a concern for the future of the #CosmosEcosystem because of the slow finality and publicness of the #IBC protocol.
11/n
Imagine how big the MEV problem will be on Crosschain-contracts based AMMs... This is why a crosschain DEX aggregator built on Secret would have a huge advantage.
12/n
๐๐ฟ๐ผ๐ป๐ ๐ฅ๐๐ป๐ป๐ถ๐ป๐ด is often used in combination with MEV and it consists in trading with inside information of another tx waiting to be validated in the mempool and preceding that with a faster one (higher GAS fee).
13/n
The difference between MEV and Frontrunning is the fact that MEV requires the block producer to reorder txs, while Frontrunning can be performed by anyone with access to a block explorer like @mintscanio (and a fast bot ๐)
14/n
Anyway both are possible because of the public nature of blockchains, popular DEXs such as @osmosiszone are the targets and users are paying the price!
There are various complex solutions to them, but Secret Network definitely has the simplest and most effective:
15/n
Bad MEV and Frontrunning are impossible due to an encrypted mempool and blockchain state:
With the use of ๐๐๐๐ฌ nobody (even validators) can see the content of blocks making it impossible to extract the necesarry information to frontrun txs.
cutt.ly/VZDCDe0
16/n
On Secret the new LP pool info is accessible as soon as the block is final so that everyone can take advantage of arbitrage opportunities at the same time
17/n
The frontrunning problem also applies to CEXs and OrderBook based DEXs such as @DyDx, @InjectiveLabs, @SushiSwap, @CrescentHub, @TeamKujira.
Frtunately, once again, the modularity of the Secret Blockchain allows for DEXs to be built in it and avoid the problem.
18/n
This solution was adopted by ButtonSwap, @sienna_network, @secret_swap and ShadeSwap which use Secret Contracts and Secret Tokens to hide the txs metadata.
This protects userโs financial privacy and investments at the same time.
19/n
@Btn.group took it to the next level by building a private (front running and MEV resistant) OrderBook based DEX.
They made it so that, unlike traditional orderbooks, orders are only visible by the users placing them (or anybody that has the viewing key)