The blockchain economy is now at over $1T in total value and growing at an exponential pace, with the DeFi ecosystem alone already doubling in value locked since the start of the year. However, alongside the growing adoption of smart contracts are new loopholes where value can be siphoned away from unwitting users. One such example is Miner-Extractable Value (MEV)—a dynamic where blockchain miners are able to extract profits at the expense of users by arbitrarily reordering, including, or excluding transactions within a block. Simply put, miners can determine the order of when transactions are processed on the blockchain and exploit that power to their advantage.
In the research paper “Flash Boys 2.0,” whose authors include Chainlink Labs researchers Ari Juels and Lorenz Breidenbach, MEV and transaction reordering is not just explained as a theoretical concept, but as a dynamic that is already occurring at scale in the form of transaction frontrunning on decentralized exchanges and which can have a significant impact on the user experience. In this article, we’ll explore why MEV exists, examples of MEV today, and how Chainlink Fair Sequencing Services provides a novel solution to this emerging risk in blockchain economies.
Why Miner-Extractable Value Occurs
Blockchain networks such as Bitcoin and Ethereum are immutable ledgers secured by a decentralized network of computers, known as “miners.” These miners are responsible for regularly aggregating pending transactions into blocks, which are then validated by the entire network and appended to the global ledger. While blockchain networks ensure all transactions are valid (e.g. no double-spends) and new blocks of transactions are continually produced (preventing downtime), there isn’t actually a guarantee that transactions will be ordered in the exact manner they were submitted to the blockchain.
Since each block can only contain a limited number of transactions, miners have full autonomy in selecting which pending transactions in the mempool—the location miners store unconfirmed transactions off-chain—they will include in their block. While miners usually order transactions by the highest gas price (transaction fee) in order to maximize their profits, this is not a requirement by the network. As a result, miners can extract additional profits from users by taking advantage of their ability to arbitrarily reorder transactions, creating what is commonly known as miner-extractable value (MEV).
While MEV is the most common terminology for this concept, most forms of MEV seen today are taken not from miners themselves, but from third-party bots. These bots manipulate the ordering of their transaction within a block by changing the transaction fee they pay to miners. This means MEV can be extracted even when miners order transactions according to the highest gas prices. However, MEV can be seen as the upper bound of how much value can be extracted by miners, since miners ultimately have control of the final transaction ordering within a block.
MEV comes at the expense of regular users, often in ways that may not be immediately apparent to all users until after their transaction is processed. This can include the increase of the network’s transaction fees and additional slippage on trades, both of which extract value directly from users.
Exchange Arbitrage and Gas Price Bidding Wars
The most common form of MEV seen today is third-party bots performing arbitrage between two or more decentralized exchanges (DEXs). An arbitrage opportunity is created when the price of a crypto asset on one exchange deviates from another, typically caused by a large trade on one of the exchanges. Arbitrage bots profit from this opportunity by purchasing an asset on the exchange offering a lower price and selling it on the exchange offering a higher price, bringing both exchange prices back to an equilibrium while earning a profit. Additionally, arbitrage can also be performed between on-chain DEXs and off-chain centralized exchanges.
With the increased adoption of DeFi and growing liquidity within DEXs, the occurrence and profitability of these arbitrage opportunities has increased, leading to a growing competition between arbitrage bots. These bots compete by engaging in a bidding war, which leads to them continually raising the transaction fee they are willing to pay miners in an attempt to get their transaction processed first. They engage in such behavior because they know miners are incentivized, as rational economic actors, to order transactions according to the highest gas price. While this form of MEV ensures market prices are aligned across exchanges, it has a detrimental side effect.
The result is that the blockchain network’s bandwidth becomes consumed by increasingly competitive arbitrage transactions, raising the transaction fees for everyone else on the network. The transaction fees paid by the arbitrage bots, which is often a large percentage of the final profits generated from the arbitrage, goes directly to the miners. This means that miners still benefit from this form of MEV even without taking the arbitrage opportunity for themselves, as they earn increasingly more transaction fee revenue.
Exchange Frontrunning and “Invisible Fees”
Another form of MEV that can be considered more directly detrimental to the user experience are bots who frontrun trades made by users on decentralized exchanges. Because all transactions from users must go through the mempool, these front-running bots can monitor for large trades entering the mempool and use this advanced knowledge to their benefit.
For example, if a large trade is spotted, a front-running bot can copy the user’s trade and pay a higher transaction fee to get their transaction processed first. This moves the market price of asset being traded, causing the user’s trade to incur a larger amount of slippage—the difference between the expected price of a trade and the actual price. After the user’s trade is processed, the market price of the asset being traded further shifts in the frontrunner’s favor, which allows them to take profits by selling their assets.
As a result, the user’s trade is executed at a suboptimal exchange rate, increasing the costs of using decentralized exchanges in the form of an “invisible fee” where fewer tokens than initially expected are received. Similar to exchange arbitrage, frontrunning bots compete for these opportunities by engaging in a transaction fee bidding war to get their transaction processed first, thereby inflating the cost of creating any transaction on the blockchain network.
Exchange arbitrage and frontrunning represent just two examples of how MEV is generated and can adversely affect users. However, they are not the only situations in which MEV is possible. If and when miners begin to capture more MEV opportunities for themselves, it is possible that more advanced reordering strategies are used to further extract value from users. While arbitrage bots and frontrunning bots can only reorder their transactions by paying a higher transaction fee, miners can reorder and insert their own transactions into a block for free. This opens up even more opportunities for MEV, which in the worst cases can lead to block reorganizations and consensus instability.
Solving MEV: Chainlink Fair Sequencing Services
In order to solve the problems created by miner-extractable value, Chainlink is developing Fair Sequencing Services (FSS)—an MEV solution that uses a decentralized oracle network to fairly order transactions sent to an on-chain smart contract. By separating the ability to order transactions from the ability to produce blocks, malicious value extraction such as frontrunning can be prevented through predefined ordering policies. Chainlink FSS aims to support any transaction ordering policy required by smart contracts including “time of arrival in the mempool”, where transactions are ordered sequentially according to the relative time each transaction was submitted. Chainlink FSS can also engage in more advanced strategies such as ordering encrypted transactions, which are only decrypted after the oracles have committed to a specific ordering.
Chainlink FSS decentralizes the process of transaction ordering, ensuring that smart contracts process transactions in a provably fair manner devoid of any preferential ordering. FSS not only prevents unfair transaction ordering but also has the potential to lower network gas prices (transaction fees) by reducing the occurrence of gas price bidding wars. Depending on the ordering policy, the amount of fees a user pays has no effect over the final ordering of their transaction relative to other transactions. Additionally, the FSS solution has been specifically designed without requiring any changes to the base layer blockchain on which smart contracts operate.
Fair Sequencing Services intends to support various ways in which users can submit their transactions to be ordered. This includes submitting transactions directly to the oracle network off-chain, as well as a variant where users submit their transactions directly to the blockchain mempool. The latter means FSS can be constructed to have full compatibility with existing user wallets and infrastructure.
As a framework for implementing ordering policies, Chainlink FSS allows smart contract developers to ensure that their application treats users fairly according to predefined criteria. By guaranteeing transactions are ordered fairly and lowering network transaction fees, FSS drastically improves the user experience of interacting with smart contract applications. The end result is a DeFi ecosystem that is able to achieve its highest potential of providing a more economically fair world, backed by mathematics and cryptographically enforced guarantees.