From HashKey Capital Insights by Jeffrey Hu
The article is co-written by: Jeffrey HU, Jinming NEO @HashKey Capital, George ZHANG @Flashbots
Introduction
The concept of Bitcoin MEV (Miner Extractable Value) emerged as early as 2013. Although fairly nascent relative to MEV on Ethereum, the burgeoning Bitcoin ecosystem with the introduction of metaprotocols such as BRC-20s, Ordinals, Runes promises to bring more programmability, expressivity, and MEV opportunities in future.
This report will analyze the increasing complexity of MEV on Bitcoin and assess its implications for the broader ecosystem.
Why Is There an Increasing Focus on Bitcoin MEV?
Before the introduction of Ordinals, MEV on Bitcoin was not widely recognized and significant, with focus on lightning network and sidechain mining attacks. However, the Taproot Upgrade has ushered in more expressivity and programmability on Bitcoin, facilitating the launch of metaprotocols such as Ordinals and Runes that brought concerns of MEV to the forefront. The 10 minute block time of Bitcoin also exacerbated the issue, making it easier for inexperienced users to become victims of various forms of MEV attacks such as fee sniping when bidding on inscription marketplace. As block rewards decline, miner profitability suffers, driving miners to focus on maximizing transaction fees, which may explain the rise in MEV activity.
The chart below illustrates the surge in fees relative to block rewards surrounding the highly anticipated Ordinals and Runes launch, at one point even constituting more than 60% of total bitcoin mining revenue share.
Source: Dune analytics (@data_always), transaction fee share % of mining reward, data as of 22 July 2024
Till date, we have seen an increasing number of BTCFi applications and developments, transitioning Bitcoin’s status from just a digital gold / payment network to a blossoming ecosystem with rapidly growing utilities. This could bring up more MEV opportunities onto Bitcoin.
Differences between MEV on Bitcoin vs Ethereum
The limited discussion about MEV on Bitcoin can be attributed to the vastly different architectural designs between Bitcoin and Ethereum.
Architectural Design
Ethereum, which operates on the Ethereum Virtual Machine (EVM) enabling the execution of smart contracts, achieves programmability through maintaining a global state machine.
Ethereum adopts an account-based model that runs transactions sequentially via management of transaction nonce. This means that the order of transactions can affect their execution outcomes, creating issues where searchers are able to easily identify MEV opportunities and insert their transactions directly before or after a user transaction. For example, if Alice and Bob both submit transactions to Uniswap to exchange 1 ETH for USDT, the transaction executed first in the block will receive more USDT.
In contrast, Bitcoin, which runs on the Script language which isn’t stateful like Ethereum, adopts a UTXO model. If it is just a standard bitcoin transfer, only the intended recipient can spend the output via a valid signature, which does not result in competition from other users to spend the fund. However, on Bitcoin, it is also possible to construct UTXOs that can be unlocked by multiple parties using scripts or SIGHASH. The transaction that confirms first is the one that can spend the UTXO. Nonetheless, since the unlocking conditions of each UTXO are solely related to the UTXO itself and do not depend on other UTXOs, hence the racing condition is only limited to this UTXO.
Altcoins on Bitcoin
Apart from the fundamental differences in the design mentioned above, introducing valuable assets beyond BTC has also created incentives for Miner Extractable Value (MEV). The MEVs that arise from these scenarios are essentially the order by which the protocol designers specify assets ownership and on-chain actions legitimacy when they try to build new asset classes and on-chain behaviors on BTC using script + UTXO, a data structure native to BTC. With events defined based on order, there is an incentive to compete for order, and hence MEV.
Without considering other assets, rational miners would only package legitimate transactions based on transaction fees and charge fees according to the transaction size. However, if a Bitcoin transaction represents more than just a standard transfer, such as minting a new valuable asset (like Runes, etc.), miners could adopt various strategies beyond just considering Bitcoin transaction fees: 1) review the transaction and replace it with their own mint transaction; 2) demand higher fees from users (on-chain, off-chain, or sidechain payments); 3) let multiple users bid against each other resulting in a fee war.
Mint
A direct example is the minting process for assets like Runes or BRC20, where a maximum limit for minting assets is generally set. The first confirmed mint transaction is considered successful, while others are deemed invalid. Therefore, the order of transactions in this context becomes crucial and provides opportunities for MEV through transaction ordering.
Additionally, the concept of rare satoshis introduced by Ordinals has even raised concerns that miners might cause block reorganizations during halving periods to compete for high-value rare satoshis.
Staking
In addition to minting, staking protocols like Babylon also set a cap on the amount of assets that can be staked during each phase. Even if users exceed the cap, they can still construct and send Bitcoin to the staking lock script, but it will no longer be considered a successful stake and will not be eligible for future rewards. In other words, the ordering of staking transactions is also crucial.
For example, soon after Babylon mainnet launch, the phase-1 staking cap of 1k BTC is reached, resulting in about 300 BTC being overflowed and needing to be unbonded.
Feerate surged over 1k sats/vBytes when Babylon mainnet launch, Source: Mempool.space
Beyond on-chain minting/engraving assets and staking, some activities on sidechains or rollups are also affected by MEV. We will provide more examples in the section “Events of MEV on Bitcoin.”
What is Considered as Bitcoin MEV?
So, what exactly can be considered MEV on Bitcoin? After all, the definition of MEV varies under different circumstances.
Generally speaking, MEV on Bitcoin, refers to the various ways miners can manipulate the block creation process to extract maximum profit. We can roughly categorize them as follows:
- Users paying extra fees: A common channel for users who are looking to expedite their transaction is through off-chain transaction acceleration services which is often costly since users receive priority for their transaction to be included. Traders can also offer higher fees to miners through mechanisms like RBF (Replace-by-Fee) and CPFP (Child Pays for Parent) to have transactions prioritized and achieve faster confirmation time. Transactions which have low fee rates and fees often face longer confirmation times as profit driven miners prioritize profitable transactions for block inclusion.
- User-miner collusion: Users and miners colluding to scrutinize or include certain transactions with specific significance. For instance, malicious users and miners colluding to review and exclude penalty transactions on the Lightning Network to illegally obtain assets within the channel. Other new systems such as BitVM and its penalty transaction also face such risks.
- Bitcoin miners mining on sidechains / L2: This includes various early merge-mining schemes, where miners reuse computational power on Bitcoin to secure another network. With merge mining, it can encourage miners centralization as large miners might leverage their computational power on the main chain to influence block production, ordering, etc., on L2, thereby obtaining excessive L2 mining rewards and potentially affecting L2 network security.
A fee bidding method leaning towards the public market (such as RBF), plays a relatively positive role in the overall economic system, promoting a free market economy. However, when users engage in out-of-band payments with mining pools, it undoubtedly poses threats to the decentralization and censorship-resistance of the network, which has been labeled as “MEVil”.
Examples of Bitcoin MEV
Based on the classifications mentioned, we can observe several cases of MEV.
Non-standard Transactions
Bitcoin Core software only allows nodes to process standard transactions up to 100 kvB. However, mining pools still include non-standard transactions with high fees in blocks, often at the expense of excluding other lower-fee transactions.
Some typical examples include:
- Block 776,884: Mined by the Terra pool, this block contains an inscription transaction of size 849.93 kvB. The inscription, which is a 1-minute MP4 video of a frog holding a drink, earned the miner a fee of 0.5 BTC.
- Block 777,945: Contains a 4000 x 5999 pixel WEBP image of size 975.44 kvB, earning the miner 0.75 BTC in fees.
- Another block, 786,501, received approximately 0.5 BTC in fees for an inscription of a JPEG image of Julian Assange on a Bitcoin magazine cover, taking up 992.44 kvB.
By default, Bitcoin Core nodes are only allowed to relay standard transactions. Therefore, non-standard transactions must be directly submitted to mining pools through private mempool. Private mempools allow mining pools to accept non-standard transactions and prioritize users’ transactions. While this can speed up transaction processing, the shift of more transactions to private mempools may lead to increased centralization of mining pools and heightened censorship risks. Clearly, some mining pools are already capitalizing on the profitability of operating private mempools.
For example, Marathon Digital introduced “Slipstream,” which is a direct transaction submission service that allows customers the ability to submit complex and non-standard transactions.
MEV Events on Side Chains / L2s
The Stacks sidechain uses a unique consensus mechanism, Proof of Transfer (PoX), which allows Bitcoin miners to mine Stacks blocks and settle transactions on the Bitcoin blockchain while earning STX rewards.
In the past, Stacks employed a simple miner election where Bitcoin miners with high hashrates stand a higher chance to mine stacks block, censoring commitment transactions of other miners thereby earning all the rewards to itself. If more miners adopted this strategy, future Stackers might suffer from suboptimal yields.
Impact on the ecosystem:
1. By excluding commitments from other honest miners, the rewards eventually passed to stackers are reduced.
2. If large miners continue to abuse their computational power and exclude honest miners’ commitments, it could lead to centralization issues, allowing a few miners to reap the full stacks rewards.
However, this issue will be mitigated by the Stacks Nakamoto upgrade, which will make this strategy unprofitable again. This upgrade will shift from a simple miner election to using the sortition algorithm and employing the Assumed Total Commitment with Carryforward (ATC-C) technique to reduce the profitability of MEV mining. Miners are expected to show consistent participation in the last 10 blocks to qualify for sortition. Miners who did not mine in at least 5 of the last 10 blocks will be disqualified from winning any Stacks rewards. With ATC-C, the probability of a miner winning a Stacks block is now equal to the miner’s BTC expenditure divided by the median total BTC commitment in the most recent 10 blocks. This reduces the incentive for miners to gain disproportionate benefits by excluding other miners’ block commitments.
Bidding for Alternative Asset Transactions
The MEV related to alternative assets like Ordinals and Runes can be categorized into the two types mentioned earlier:
- Mining pools extracting additional value: Mining pools can gain extra value from assets like Bitcoin Ordinals or rare satoshis by including them in blocks and transactions.
- Fee sniping transactions: Traders may bid to include their transactions related to these alternative assets in blocks.
For mining pools, the initial success of Runes provided an additional profit source. For example, during the halving event, the highly anticipated launch of Runes led to a record-high network transaction volume and fees, as many users competed to have their transactions included in the historic Bitcoin halving block. Post-halving transaction fees surged to over 1,500 sats/vByte (up from less than 100 sats/vByte before the halving). ViaBTC capitalized on this surge by mining the halving block that coincided with the launch of Runes, earning a profit of 40.75 BTC in block 840,000, with 37.6 BTC coming from Runes-related transaction fees. As block rewards are now halved, transaction fees from Runes have proven to be a profitable source of revenue for miners.
Source: Mempool.space
Source: Mempool.space
For traders, Bitcoin transactions using Runes and Ordinals employ SIGHASH_SINGLE|SIGHASH_ANYONECANPAY for PSBTs (Partially Signed Bitcoin Transactions) which allows only one signed input to correspond with one output. Coupled with the transparency of the mempool, this enables many buyers to discover potentially profitable trades. Therefore, traders frequently use RBF and CPFP leading to competitive fee wars, allowing miners to capture MEV from this demand. For instance, when sellers list their assets for sale, buyers can place bids and use RBF to increase their transaction fees when there are competitors, hoping their transaction gets confirmed.
A typical example of this competition among traders is the transaction with the ID:2ffed299689951801a68b5791f261225b24c8249586ba65a738ec403ba811f0d. After the seller listed their assets, the transaction was repeatedly replaced using RBF with fee rates of 238, 280, 298, and 355 sat/vB.
Source: Mempool.space
Another example involves the OrdiBots minting process on the Magic Eden platform. Several users became victims of transaction pool front-running attacks. OrdiBots’ minting inscriptions on Magic Eden used PSBTs. The existence of PSBT and 10 minute Bitcoin block interval allow any potential buyers to compete for the same transaction by introducing different addresses, signatures, just by paying higher fees. This resulted in some whitelisted users being unable to mint due to interference from front-running bots. (The team later apologized and promised to compensate affected users with custom OrdiBots.)
However, not all MEV-related techniques or events are detrimental to users. MEV techniques can also protect user assets from loss in some cases. For example, without RBF, erroneous transactions cannot be salvaged, and stuck transactions can remain in limbo for extended periods leading to opportunity cost. Additionally, running RBF benefits Bitcoin’s network security. As block subsidies are expected to decrease relative to transaction fees in the future, transaction fees will play a crucial role in incentivizing miners to continue participating in the Bitcoin network. Bitcoin developer Peter Todd has also been vocal about the benefits of RBF and recommended miners to run full RBF.
Key Technical Components Facilitating MEV On Bitcoin
So, what are the key technical components or methods on Bitcoin that support these MEV opportunities? The commonly involved technical areas include mempools, RBF (Replace-by-Fee), CPFP (Child Pays for Parent), mining pool acceleration services, and mining pool protocols.
Mempool
Similar to Ethereum and other typical blockchain networks, Bitcoin also has a transaction pool structure used to store transactions that have been received by P2P nodes but have not been included in a block. The transparent and decentralized nature of mempool allows all transactions to be propagated to miners, providing a conducive environment for MEV opportunities.
However, unlike Ethereum’s gas mechanism, Bitcoin’s fees are only related to transaction size. Therefore, Bitcoin’s transaction pool can be seen as a more direct block space auction market, where one can observe which users are bidding for the next block and at what prices.
Because different nodes receive different transactions from P2P propagation, every node has a different mempool. Additionally, each node can actively customize its own forwarding strategy (mempool policy), defining which transactions it wants to receive and relay. Mining pools can also choose which transactions to include in blocks based on their preferences (though economically, they will prioritize higher-fee transactions). For example, Bitcoin Knots nodes filter out any Ordinals transactions, while Marathon Mining has created a pixel-style logo in the explorer.
Block 836361(the color of pixels show the fee rates), Source: mempool.space
So, users might consider sending transactions directly to specific miners or mining pools to accelerate transaction inclusion, but this approach can compromise two key features that the Bitcoin community highly values: privacy and censorship resistance.
Transactions propagated through P2P nodes rather than sent directly (e.g., through an RPC endpoint) to miners or mining pools help obscure the origin of the transaction, making it harder for miners and pools to censor transactions based on identified information.
Aside from utilizing transaction acceleration services, users can also opt to accelerate their transactions through RBF and CPFP.
RBF and CPFP
Replace-by-Fee (RBF) and Child Pays for Parent (CPFP) are methods users commonly employ to increase transaction priority.
RBF (Replace-by-Fee) allows an unconfirmed transaction in the transaction pool to be replaced by another transaction that conflicts with it (also referencing at least one of the same inputs) but pays a higher fee rate and overall higher fees. Similar to transaction pool strategies discussed earlier, RBF can be implemented in various ways. The most common implementation is optional RBF (opt-in RBF) designed by BIP125, where only specially marked transactions can be replaced. Another approach is full RBF, where transactions can be replaced regardless of whether they are marked.
CPFP (Child Pays for Parent) uses a different approach to expedite transaction confirmation. Instead of replacing a transaction stuck in the mempool as seen in RBF, recipients can accelerate the pending parent transaction by sending a child transaction that uses the UTXO in the pending transaction with a higher fee rate. This potentially incentivizes miners to batch these transactions together in the next block. Therefore, you might sometimes see transactions with very low fees being included in a block despite high fee rates at a given moment; these transactions are likely using CPFP (since the subsequent transaction pays for the fee).
The transaction used CPFP to let the parent transaction with low fee rate (7.01 sat/VB) confirmed, Source: mempool.space
The key difference between RBF and CPFP is that RBF allows the sender to replace a pending transaction with one that has a higher fee rate whereas CPFP allows the recipient to speed up a pending transaction by sending a child transaction with a higher fee rate. CPFP is also useful for transactions that need to be exited from Lightning Network (e.g., anchor outputs). In terms of fees, RBF is relatively more cost advantageous as it does not require additional block space.
Out-of-Band Fee Payment and Mining Pool Acceleration Services
In addition to methods like RBF (Replace-by-Fee) and CPFP (Child Pays for Parent), users can also choose to use out-of-band fee payment to accelerate their transactions. For instance, many mining pools offer both free and paid transaction acceleration services to speed up the packaging of transactions by submitting their txID. If it is a paid service, users need to pay a service fee to subsidize the mining pool. Since this type of service involves paying fees through systems outside of the Bitcoin network (such as through websites, credit card payments, etc.), it is referred to as out-of-band fee payment.
Although out-of-band fee payment provides a remedy for transactions that cannot use RBF or CPFP, extensive use over a long period could affect Bitcoin’s censorship resistance.
Mining Pool Protocols
In the previous discussion, we considered mining pools and miners as a single group, but in reality, there is a need for division of labor and cooperation between them. Mining pools aggregate the computational power of miners for mining and allocate rewards based on the contribution of computational power. This cooperative process requires certain protocols for coordination.
In common mining pool protocols, such as Stratum v1, the mining pool only needs to provide miners with a block template (including the block header and coinbase transaction information), and miners perform hash calculations based on this template. There are also tools, like stratum.work, that can visualize the Stratum information from various mining pools.
In this process, miners cannot choose which transactions to package; instead, the mining pool selects transactions and constructs a template to assign tasks to miners.
Thus, in the Stratum v1 protocol, we can roughly map the roles to the Ethereum ecosystem as follows:
- Miners: Assume part of the proposer’s responsibilities (perform hash calculations).
- Mining Pools: Act as both builders, using the hashes computed by miners, and proposers of the block.
What Does The Future Hold?
Some promising solutions have been developed or are underway to mitigate the negative impacts of MEV (Miner Extractable Value) on Bitcoin.
New Protocols
In some new mining pool protocols, such as Stratum v2 and BraidPool, miners can autonomously choose which transactions to package. Stratum v2 is already being adopted by some mining pools (e.g., DEMAND) and mining firmware (e.g., Braiins), allowing individual miners to build their own block templates. This improves the security, decentralization, and efficiency of data transmission while reducing the risks of transaction censorship and MEV on Bitcoin.
Thus, following this trend, the future roles of mining pools and miners may not evolve in the same manner as the Ethereum PBS (Proposer/Builder Separation) model.
Additionally, new designs in Bitcoin Core related to the transaction pool might bring about changes, primarily including the much-discussed enhancement of v3 transaction relay strategy and cluster mempool. However, the impact of these new designs, such as on the implementation of Lightning Network channel exits, is still under discussion.
Impact of Reduced Mining Rewards
The reduction in mining rewards is a significant issue. As block rewards decrease further in the future, it may have various impacts on the network.
Some problems have been recognized and discussed by Bitcoin developers early on, such as the fee sniping issue, where mining pools might intentionally re-mine previous blocks to capture transaction fees. Bitcoin Core has implemented some measures to counter fee sniping, but current methods are not yet perfect.
In addition to native transaction fees, alternative assets could also become a sustainable source of revenue in the future. Consequently, some projects are attempting to build infrastructure to better identify valuable transactions involving alternative assets. For example, Rebar is developing an alternative public mempool to better recognize transactions with valuable alternative assets.
However, as discussed in the “Out-of-Band Fee Payment” section, the impact of these offchain Bitcoin economic incentives on Bitcoin’s self-regulated incentive compatibility system remains to be seen.
Regardless, MEV on Bitcoin draws parallels to Ethereum but also differs due to differences in architecture and design philosophy. The increasing utility of Bitcoin, the decreasing block subsidy rewards, and the evolving BTCFi ecosystem will bring greater attention to MEV-related factors.
Special Thanks
Thanks Ajian for reviewing and suggestions!
References:
- https://bluematt.bitcoin.ninja/2024/04/16/stop-calling-it-mev/
- https://bitcoinops.org/zh/blog/waiting-for-confirmation/
- https://b10c.me/observations/09-non-standard-transactions/
- https://cyber.fund/content/the-spectre-of-mev-on-bitcoin
- https://leather.io/blog/nakamoto-impact-bitcoin-mev
- https://prestmit.io/blog/best-bitcoin-accelerators-unstuck-btc-transactions
- https://starkware.co/blog/general-computation-on-bitcoin/#4.-the-challenge-of-keeping-state-in-bitcoin-script
- https://petertodd.org/2023/why-you-should-run-mempoolfullrbf
- https://t4t5.com/blog/the-bitcoin-halving-will-be-reorged/
- https://protos.com/yes-mev-occurs-on-bitcoin-heres-how/
- https://bitcoinops.org/en/topics/out-of-band-fees/
- https://bitcoincore.org/en/faq/optin_rbf/
- https://mempool.space/
- https://www.lookintobitcoin.com/charts/puell-multiple/
- https://transactionfee.info/
- https://thedefiant.io/news/nfts-and-web3/mempool-sniping-plagues-bitcoin-ordinals
- https://protos.com/first-bitcoin-mining-pool-adds-stratum-v2-feature-to-circumvent-bitmain/
- https://www.forbes.com/sites/digital-assets/2023/12/18/demand-announce-bitcoin-stratum-v2-mining-pool/
- https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki#user-content-Summary
- https://docs.stacks.co/nakamoto-upgrade/what-is-the-nakamoto-release/nakamoto-in-10-minutes
- https://x.com/robertjfclarke/status/1765082833566257469
- https://www.theblock.co/post/302041/bitcoin-startup-rebar-raises-2-9m-to-build-mev-products
- https://x.com/blockworksres/status/1659228830350069761?s=20
All Comments