7. MEV and the Everlasting Competition for BlockSpace in Cryptocurrency
This piece is written by @-KiLLeD-by-LaG-#0664, and with major edit help from @bitsmartgee_eu from Phezzan Discord server.
Last updated
This piece is written by @-KiLLeD-by-LaG-#0664, and with major edit help from @bitsmartgee_eu from Phezzan Discord server.
Last updated
As the cryptocurrency slowly but surely transitions from a Proof-of-Work consensus mechanism to a Proof-of-Stake mechanism, due to the various advantages offered by the latter, the main advantage is Environmental concerns related to Mining and electricity usage to mine blocks and process transactions.
Ethereum recently transitioned to Proof-of-Stake on 15th September after widespread concerns over energy usage, with the ETH merge, the energy consumption by Ethereum blockchain fell by a whopping 99.95%. The majority of other chains are slowly trying to improve their throughput to match scalability demand and increase adoption. Some Layer-1 networks like Ethereum are using Layer-2 solutions like Polygon, Optimism, etc for scalability; Others like Solana have centralized validators and prefer to sacrifice decentralization to achieve higher throughput. All this is pointing toward one growing trend: BlockSpace is getting more and more abundant. What are the opportunities behind the blockspace competition? Is the competition good or bad? Let’s find out.
Part 1: Opportunities behind blockspace
BlockSpace can be defined as the space where one can run code and store data. With a Proof-of-Work mechanism like Bitcoin, the blockspace is sold by the bitcoin miners and the average consumers of these spaces are the bitcoin users, which use it to process transactions on the blockchain. All transactions initiated by users are sent to what’s known as Mempool (memory pool), where block producers decide which transaction should go first, based on the gas a user is willing to pay. Where gas is quantified by 1 gwei = 1/109 ether(1 billionth of an ether).
The more gas you use, the more profitable it's for miners to process the transaction and the faster your transaction goes through. This creates an entire ecosystem of competition for blockspace and gets the edge to process your transaction faster. It also creates 3 other options:
Arbitrage Opportunities: In decentralized finance, a user can buy an asset for a given price in 1 Decentralized exchange and then sell it for a higher price in another exchange, for a neat profit. This exists because at a given time due to various factors the value of an asset/token is based on its liquidity which differs across various exchanges.
Front-running opportunities: An end-user can also program a bot that scans the Memory pool and look for profitable trade opportunities; Once a bot finds a profitable trade, it replicates the user’s trade and pays a premium in gas price to execute the trade faster than the previous user and make the miner choose their transaction to go thru first. This is usually observed during NFT mints where users try to over-bid every other user, in order to mint a given NFT from a contract, which results in what is called a ‘gas-war’, due to many users simultaneously trying to mint an NFT from the contract at the same time as thousands of different wallets, which leads to elevated gas prices caused by congestion in the network.
Back-running opportunities: Back-running can be defined as a type of transaction in which the transaction sender intentionally sends a transaction to the Mempool in such a way that it gets executed/ordered immediately after some unconfirmed ‘target transaction’. Why would anyone want to place their transaction behind a particular transaction on the blockchain, you ask? To do price manipulation. How does this work? For instance: Imagine a new token or IDO has taken place as part of a public sale on a DEX. Now, as soon as liquidity has been added (i.e. target transaction) to the token contract at a given block, a technically sound smart contract dev can create a contract that sends multiple transactions with the same gas value as ‘target transaction’, in order to get the back-running transaction just behind ‘target transaction’. What this achieves is that the first transaction will be able to buy the token at the cheapest prices which will inflate the prices and simultaneously proceed to sell these tokens at the inflated prices to the remaining buyers and gain a neat profit! This is what happened with BZRX token launch on Uniswap where the transaction sender managed to: i.) Create a smart contract with 732 addresses and preload it with ~650 eth. ii.) Broadcast all transactions as close to the IDO launch as possible. The transaction sender did just that and managed to gain $500K in ETH, and $40K in BZRX tokens while only sacrificing approx. $350 in gas! Impressive.
Part 2: What is MEV?
This “invisible tax” that is being paid by every user to miner/block producer to process transactions is called Maximum Extractable Value (or, MEV in short). MEV is usually seen as a double-edged sword in cryptocurrency and many protocols and blockchains are building smart contracts and protocols which would allow their users to either i.) Use MEV to generate income from arbitraging opportunities on the blockchain ii.) Use MEV-resistant technologies and prevent front running and other malicious practices which may cause users to pay very high gas prices when the network is highly congested.
Part 3: Difference in MEV capturing Ethereum versus Cosmos
MEV capturing can differ across various chains like Ethereum and Cosmos based on how the blockchain decides to deal with the pending transactions on the memory pool. Ethereum, for instance, allows its nodes (or miners, previously) to rearrange transactions according to their own choice, i.e., the transactions which are processed with the highest gas price.
In Ethereum, MEV capturing can be facilitated by using an open-source smart contract called Flashbots which is a decentralized service for MEV capture and uses a sealed-bid closed auction system, which according to the official Flashbot documentation ” allows users to privately communicate their bid and granular transaction order preference without paying for failed bids. This mechanism maximizes validator payoffs while providing an efficient venue for price discovery on the value of a given MEV opportunity. Crucially, this mechanism eliminates frontrunning vulnerabilities”. Illustration of how Flashbots work is shown below (Fig 2.1).
Meanwhile, Cosmos follows the First-In-First-Out (FIFO) transaction ordering which means that MEV searchers have to “win” arbitrage opportunities by placing their bots as close to the validators and block producers’ location and spam them with transactions that are fuelled by strategically placed Low-latency infrastructure.
Osmosis, which is the biggest DEX on Cosmos, is proposing to onboard protocols like Skip Protocol which will allow them to capture MEV and potentially use it in order to:
i.) Reward stakers and block producers for onboarding their module. ii.) Fund Osmosis DAO and fund upcoming new projects and development. iii.) Award Transaction fees and gas refunds which will allow for cheaper transactions.
MEV capture will be facilitated by Skip Protocol on Osmosis by building a ‘Flashbot-styled’ sealed-bid closed auction system solution on Cosmos; (Fig 2.2 shows an illustration of Skip protocol solution on Cosmos.).
Additionally, Skip protocol also tracks the arbitrage volume of Osmosis on their website, which shows that over $7M in revenue has been captured from Osmosis due to price differences in different pools, with the maximum MEV captured during May 2022 due to Terra collapse and UST stable coin de-peg which resulted in over $2M in arbitraging opportunities captured in 2 days alone(11-05-2022 and 12-05-2022), MEV volume shown by data illustrated below (fig 2.3):
Part 4: Case Study: MEV Good or Bad?
Case 1: Usage of MEV bots to create arbitrage opportunities
MEV bots are programmed smart contracts which monitor the Mempools and search for arbitrage opportunities for their end user. For instance, one of the biggest MEV bots is currently Flashbots which aim to “mitigate the negative externalities of Maximal Extractable Value (MEV) extraction techniques and avoid the existential risks MEV could cause to stateful blockchains like Ethereum” by bringing transparency and distribution of MEV in a fair and democratized manner.
Cosmos Hub recently unveiled their revamped whitepaper for Cosmos v2.0 which seeks to utilize MEV by “...introducing an enormous variety of cross-domain maximum extractable value (MEV) opportunities. This market can be made more efficient, more secure, and more lucrative for Cosmos chains and their users. The interchain needs a secure block space market to avoid off-chain cartelization and more options for chains seeking to optimize the use of block space”. This vision will be bolstered, after more chains follow the suit of Osmosis, to capture MEV value and accrue value to their stakers and for their ecosystem. Osmosis, for instance, has processed over 469M in USD value using Inter-Blockchain Communication, in the last 30 days alone (as of 05 Oct 2022). MEV transactions could capture up to 100M in revenue annually, according to some estimations.
Case 2: MEV resistance technology to prevent front-running
On the other side of the spectrum, protocols are also designing mechanisms to prevent MEV opportunities; one such solution is being offered by Chainlink who are providing Fair Sequencing Services(FSS, in short), which aims to “secure causal ordering (atomic broadcast), where user transactions are first encrypted by users to hide transaction details, ordered by a decentralized oracle network, and then decrypted for execution on a blockchain network. As a result, the transaction payload will not be visible to nodes before the ordering process begins, removing the ability to front-run transactions based on early visibility”.
Conclusion
Given below is a figure (fig. 4) which shows MEV extracted across various chains categorized by Type, Role, and Distribution of tokens; even though MEV can be used for malicious practices like Sandwich attacks, price manipulation, etc, it can also be used for novel practices like price stabilization across Decentralised exchanges while giving profit to both market makers and end users alike. Projects like Cosmos hub have even decided to use these mechanisms for income generation and even used them as an inherent part of their revamped tokenomics.
The graphs even show a very clear trend that 96% of all MEV-related transactions are being used for Arbitraging opportunities with the remaining 4% being used in liquidation mechanisms. All in all, MEV can be summarised as a double-edged sword that provides opportunities to both retail and market makers, to generate passive income opportunities regardless of surrounding market conditions.
Sources
Welcome to flashbots | Flashbots Docs, from https://docs.flashbots.net/
Chainlink. (2021, March 10). What Is Miner-Extractable Value (MEV)? Chainlink Blog. Retrieved September 28, 2022, from https://blog.chain.link
Genç, E. (2022, September 6). https://www.coindesk.com/learn/what-is-mev-aka-maximal-extractable-value/. Coindesk. Retrieved September 28, 2022, from https://www.coindesk.com/learn/what-is-mev-aka-maximal-extractable-value/
Hart, S. (2022, September 26). Proposal Draft: A new vision for Cosmos Hub. Cosmos Forum. Retrieved September 28, 2022, from https://forum.cosmos.network/t/proposal-draft-a-new-vision-for-cosmos-hub/7328
Plunkett, B. (2022, September 27). Skip x Osmosis: Proposal to Capture MEV as Protocol Revenue on Chain. Commonwealth-Osmosis. Retrieved October 5, 2022, from https://gov.osmosis.zone/discussion/7078-skip-x-osmosis-proposal-to-capture-mev-as-protocol-revenue-on-chain
Manuskin, A. (2020, July 20). The fatstest draw on the Blockchain; Ethereum Backrunning. Medium. Retrieved October 5, 2022, from https://amanusk.medium.com/the-fastest-draw-on-the-blockchain-bzrx-example-6bd19fabdbe1