Source: Geek Web3
The concept of MEV in the Bitcoin network began to attract attention around 2013. Although the MEV issue is more commonly associated with Ethereum, Bitcoin is not without MEV issues. The design model of Bitcoin is very different from that of Ethereum, so MEV within its own ecosystem has not received much attention. But with the development of Ordinals, Runes, and various L2s, MEV is becoming more and more prominent in Bitcoin.
In this report we willexplore the increasing complexity of MEV on Bitcoin and examine its impact on the ecosystem.
< /strong>
Why you need to pay attention to Bitcoin MEV now
Before Ordinals are hot, Bitcoin’s MEV activity is not well known and is mainly concentrated in attacks such as Lightning Network and sidechain mining. The Taproot upgrade brought more programmability and promoted the launch of protocols such as Ordinals and Runes, which brought the MEV issue into focus.
Bitcoin’s 10-minute block time further exacerbates this problem, as it will increase the waiting time for transactions in the mempool, leaving more for MEV players Observation space,for example, front-running traders can provide miners with additional fees and other MEV means to obtain greater benefits; with the reduction of block rewards, miners can also find profits through other monetization channels such as inscriptions and runes. , which has led to increasingly common MEV activities.
The chart below showsthe surge in transaction fees relative to block rewards during the highly anticipated launch of Ordinals and Runes, sometimes even accounting for the total Bitcoin mining More than 60% of income.
(Source:Dune analytics, transaction fee share % of mining reward, data as of 22 July 2024)
In addition, in 2024, we will also see more and more BTCfi applications and protocols. In the future, we may see the development of Bitcoin's MEV reach higher scale.
The difference between MEV on Bitcoin and Ethereum
There is relatively little discussion about Bitcoin MEV , the important reason is that there is an essential difference between the architecture of Bitcoin and Ethereum.
Bitcoin’s UTXO model
Ethereum uses EVM to execute smart contracts and achieve programmability , and achieve this purpose by maintaining the global state. Ethereum uses an account model to execute transactions sequentially by managing the nonce of the transaction. This means that the order of transactions affects execution results, allowing searchers to easily identify MEV opportunities and insert a transaction directly before or after a user's transaction. This is similar to the racing condition problem when multiple users write data to the database at the same time.
For example, Alice and Bob send the same transaction to Uniswap at the same time: exchanging 1ETH for USDT, but the transaction executed first in the block will obtain more USDT.
Bitcoin uses a script + UTXO method without status. If it is just a typical transaction for transferring money, only the recipient can unlock it through his or her signature, and there will be no problem of reading and writing competition with other people.
However, on Bitcoin, you can also use scripts or SIGHASH to construct UTXO that can be unlocked by multiple people. At this time, the transaction confirmed first will get the money. However, because the unlocking conditions of each UTXO are only related to itself and will not depend on other UTXOs, the competition state is only limited to this UTXO.
Introduction of assets other than BTC
In addition to the essential differences in the above designs, the introduction of BTC External valuable assets also trigger the conditions for generating MEV. The MEV generated by these scenarios is essentially the result of protocol designers trying to use scripts + UTXO to build new asset classes and on-chain actions on BTC, using the order to stipulate the income of assets and the legality of actions. . With events based on sequence definition, there is an incentive to compete in sequence, and there is MEV.
Without considering other assets, rational miners will only package legal transactions according to the transaction rate and charge corresponding fees based on the size of the transaction data; but If the meaning of a transaction is no longer an ordinary transfer, but minting a valuable asset (such as Runes, etc.), miners can have a variety of strategies:
1) Reject the transaction and mint the inscription assets yourself;
2) Ask the user for a higher handling fee;
3 ) Let multiple users who issue transactions at the same time bid
Mint
The most direct example is in Runes, During the mint process of assets such as BRC20, the upper limit of the asset mint is generally agreed upon. The mint transaction that is confirmed first will be considered successful, otherwise it will be considered invalid. Then the order of transactions will be crucial in this scenario, which provides an opportunity to sequence MEV transactions. In addition, the concept of rare satoshis introduced by ordinals has even made some people worry that miners will compete for high-value rare satoshis during the halving, causing block reorganization.
Staking
In addition to mint, staking protocols such as Babylon will also stipulate the assets that users can stake at each stage. upper limit. Although users can still construct and send Bitcoin to the staking locking script after reaching the upper limit, it is no longer considered a successful stake at this time and will not be able to receive rewards in the future. In other words, the order of staking transactions is also crucial.
For example, Babylon quickly reached the upper limit of 1,000 BTC in phase-1 after the mainnet was launched, causing the subsequent approximately 300 BTC to exceed the limit and require users to manually Unlocked.
(When Babylon mainnet was launched, the rate soared to more than 1k sats/vBytes, Source: Mempool.space) p>
In addition to the engraved/etched assets and staking on the main chain, some activities on the side chain or rollup will also be affected. We will list more examples in "The MEV Incident on Bitcoin".
What counts as Bitcoin's MEV
So what can be counted as MEV, or more strictly Say, MEV on Bitcoin? After all, the definition of MEV is not very consistent in various contexts.
Generally speaking, MEV, Miner Extractable Value or Maximum Extractable Value, refers to the different ways miners can manipulate the block creation process to extract maximum profits. This type of activity can be presented in a variety of ways. We can roughly divide it into the following categories according to its participants and revenue destination:
Users pay additional fees: For example, out-of-band transaction acceleration service, private transaction pool (private mempool), etc. Traders can also pay miners higher fees through RBF, CPFP and other means to confirm transactions with MEV value.
Conspiracy between users and miners: Users and miners conspire to censor some transactions of specific significance or Pack. For example, evil users conspire with miners to review the penalty transactions of the Lightning Network to prevent them from being packaged and illegally obtain assets in the channel. Other new contract-based protocols, including BitVM2’s penalty transactions, will also face similar problems.
Miners' mining of L2:Including the earliest various merged mining schemes, miners are While providing computing power to Bitcoin, the calculation results are also used in other side chains or L2 networks. Miners may use their computing power on the main chain to affect L2's block production, sorting, etc., thereby obtaining excess L2 mining profits and even affecting L2's network security.
It can be seen that if the bidding method is biased towards open market means (RBF, etc.), it will still have a relatively good positive impact on the entire economic system. Incentive effect; but whether users directly send transactions to mining pools, or mining pools make profits by filtering transactions, it will undoubtedly challenge the decentralization and censorship resistance most cherished by the Bitcoin community, so it is also called " MEVil".
Typical cases of Bitcoin MEV
According to the above classification, we can see many related cases .
Non-standard transactions: non-standard transactions
Bitcoin Core software only allows nodes to process no more than 100kvB Standard transaction. However, mining pools still include non-standard transactions that offer high transaction fees in blocks, often at the expense of other low-fee transactions.
Some typical examples include:
Block 776,884 was mined by the Terra mining pool and contained a 1-minute mp4 video of 3.38MB in size showing a frog holding a drink, earning miners 0.5 BTC in fees. This transaction accounted for 849.93 kvB.
Block 777,945 contains a 4000 x 5999 pixel WEBP image, accounting for 975.44 kvB, earning miners 0.75 BTC.
Another block 786,501, received a fee of about 0.5BTC to burn a 992.44 kvB, Julian Assange's JPEG image of Bitcoin Magazine cover.
The default Bitcoin Core node is only allowed to forward standard transactions. Therefore, non-standard transactions must directly contact the mining pool through the private exchange pool. Private transaction pools allow pools to accept non-standard transactions and provide guarantees of transaction inclusion. While this can speed up transaction processing, it can lead to pool centralization and increased risk of censorship as more transactions are moved to private transaction pools. Apparently, some mining pools are already taking advantage of the profit opportunities of operating private trading pools.
For example, Marathon Digital introduced "Slipstream", which facilitates private trading pools. This allows Marathon to offer customers the ability to submit complex and non-standard transactions to the network.
MEV events on the side chain or L2
Stacks side chain previously adopted a special consensus How: Proof of Transfer (PoX) allows Bitcoin miners to mine Stacks blocks and settle their transactions on the Bitcoin chain.
Stacks participants make block commitments during transfers on the Bitcoin chain to gain the opportunity to obtain block production rights and corresponding rewards on Stacks. Through a weighted random function, the winning miner can mine blocks on the Stacks network. This results inbig miners censoring the transactions of other Stacks participants and only packaging their own block commits, thereby single-handedly receiving massive STX rewards.
As more and more miners adopt this strategy, it is unlikely that other Stacks participants will be able to receive rewards.
What impact does this behavior have on the ecology?
1) By excluding commitments from other honest miners, this reduces the rewards ultimately passed on to stackers
2) If large miners continue to abuse their computing power and exclude the commitment of honest miners, it may also lead to centralization problems, allowing a few miners to completely monopolize the benefits.
However, this problem is now alleviated with the Stacks Nakamoto upgrade, which makes this strategy unprofitable again. This upgrade will change from simple miner election to using a sorting algorithm, Assumed Total Commitment with Carryforward (ATC-C) technique, which reduces the profitability of MEV mining. Due to the use of ATC-C, the probability of a miner winning a sort is now equal to the miner's BTC spent divided by the median total BTC commitment in the last 10 blocks.
In addition, miners who have not mined in at least 5 of the past 10 blocks will be disqualified from receiving any Stacks rewards. This reduces the incentive for miners to gain disproportionate benefits by excluding other miners’ block commitments.
Bidding for alternative asset transactions
For the MEV of alternative assets such as Ordinals and Runes, it can also be attributed to The aforementioned two categories:
For mining pools, Runes’ excellent performance at the beginning provided an additional source of profit for the mining pools. For example, during the halving, the highly anticipated launch of Runes drove network transaction volume and fees to record highs, as many users rushed to have their transactions included in the historic Bitcoin halving block. Post-halving transaction fees have exceeded 1,500 sats/vByte (from less than 100 sats/vByte before the halving).
ViaBTC successfully capitalized on the craze, mining the halving block that coincided with the launch of Runes, and made a profit of 40.75BTC at block 840,000, of which 37.6BTC came from Runes-related transaction fees.
Source: Mempool.space
For traders, Runes and Ordinals transactions on Bitcoin use special opcodes to allow signed inputs and outputs to be combined, and the transparency of the transaction pool also allows many buyers to discover potential of profitable transactions.
So for trading opportunities that arise, traders will also frequently use RBF (fee replacement) and CPFP (son for father) to bid, so that miners can also take advantage of them. This requirement comes to capture MEV. For example, when a seller lists their property for sale, a buyer can place an offer and use RBF to increase their own transaction fees if there are competitors, hoping that their transaction will be confirmed.
The picture below is an example of competition between traders:
2ffed299689951801a68b5791f261225b24c8249586ba65a738ec403ba811f0d
This transaction is very typical. It can be seen that after the seller placed the order, the transaction was replaced multiple times using RBF at rates of 238, 280, 298, and 355 sat/vB.
Source: Mempool.space
Another example is the OrdiBots casting process on the Magic Eden platform . Several users fell victim to trading pool front-running attacks. OrdiBots’ minted inscription uses PSBT (Partially Signed Bitcoin Transaction) on Magic Eden.
PSBT and the 10-minute block interval allow any potential buyer to compete for the same transaction by introducing a different address, signature and paying a higher fee. This resulted in several whitelisted users being unable to mint due to interference from preemptive attack bots (the team has since apologized and promised to compensate affected users with customized OrdiBots).
But not all MEV-related technologies or events are harmful to users. MEV's technology will also protect user assets from loss in some events. Without RBF enabled, erroneously placed orders cannot be rescued, and stuck transactions will remain stuck for a long time. Therefore, Peter Todd and others also recommend that all nodes enable the full RBF option to forward transactions that are not marked RBF.
Important technical components or means of MEV on Bitcoin
So which Bitcoins are these MEVs made of? Supported by the technical means already provided? Common technical areas currently involved include trading pools, RBF, CPFP, mining pool acceleration services, mining pool protocols, etc.
Transaction pool (mempool)
And Ethereum and other typical blockchain networks Similarly, Bitcoin also has a transaction pool structure, which is used to save transactions received by P2P nodes but not yet confirmed in the block. Similar to Ethereum, the transaction pool can also play a very important role in Bitcoin's MEV and can be used to view and estimate which transactions will be packaged.
But unlike the Ethereum gas mechanism, Bitcoin's handling fee (fee) is only related to the transaction volume, so the Bitcoin transaction pool can be seen as more direct In the block space auction market, you can see which users are bidding for the next block and at what price.
Because different nodes receive different P2P transactions, there is no unique transaction pool in the Bitcoin network. Moreover, each node can also actively customize its own forwarding policy (mempool policy) and define the transactions it wants to receive and forward;
The mining pool can also follow its own preferences to choose which transactions to package(although the economic rationale is to prioritize transactions with high confirmation fees). For example, Bitcoin Knots nodes do not accept and forward transactions from ordinarys, and the Marathon mining pool also built a pixel-style logo in the browser.
(Block 836361 displayed in the browser (pixel color indicates the rate of the transaction), Source: mempool.space) p>
So users may consider sending transactions directly to miners or mining pools in the hope of faster packaging, but this will compromise two features that the Bitcoin community attaches great importance to: privacy and resistance. censorship.
Transactions are propagated through P2P nodes instead of being sent directly (such as through an RPC endpoint) to miners or mining pools, which helps to obfuscate the entity information behind the transaction, making miners and mining pools unable to Transactions are reviewed using these identified identities.
But sometimes we really want the transaction to be confirmed faster, or when it is difficult to be included in the block because the previously set handling fee is too low, we still have some Tools are available, namely RBF and CPFP.
RBF, CPFP
Handling fee replacement (RBF< /strong>) and son for father (CPFP) are methods commonly available to users to increase transaction priority.
RBF (Replace-By-Fee) allows to replace an unconfirmed transaction in the transaction pool with another that conflicts with it (also refers to at least one of the same input) and pay higher handling rates and higher overall handling fees.
Similar to the trading pool strategy discussed above, RBF can actually have various implementation rules, but the most commonly used implementation is the optional RBF (opt-in RBF) designed in accordance with BIP125. , that is, specially marked transactions can be replaced; the other is full RBF, where transactions can be replaced regardless of whether they are marked or not.
The CPFP (Child Pays For Parent) additional handling fee adopts another idea. Although the user first sends an unconfirmed low-fee transaction, he can now pay a higher fee in subsequent transactions (using the output of the previous transaction as input), thereby motivating miners to use both transactions. Pack.
So sometimes you can see in the browser that although the rate at a certain moment is very high, there are still extremely low-rate transactions packaged into the block. These transactions It is likely that CPFP is used (because it is paid by subsequent transactions).
(This transaction uses CPFP to allow the low-rate (7.01 sat/VB) parent transaction to be packaged and confirmed Source: mempool.space)
The main difference between CPFP and RBF is that RBF increases the handling rate by the payer, while CPFP allows the receiver to increase the handling rate to speed up transaction confirmation. At the same time, for the Lightning Network This is useful for pre-signed transactions that need to be exited (such as anchor outputs). But RBF also has cost advantages because no additional block space is required.
Additional payment and mining pool acceleration services
Ultra-low fee transactions are packaged Another possibility is to use an additional fee.
In addition to direct transactions such as RBF and CPFP that add on-chain handling fees, users can also choose to use out of band fee payment. Accelerate your own transactions.
For example, many mining pools provide free and paid transaction acceleration services to accelerate and package transactions submitted by users with txid. If it is a paid service, the user needs to pay a fee to the mining pool to make up for the difference in handling fees of the mining pool. Because this type of service pays for processing fees in a system outside the Bitcoin network (such as through website recharge, credit card payment, etc.), it is called an additional fee.
Although out-of-band payments provide a remedy for transactions that cannot use RBF or CPFP, if used in large quantities for a long time, it will affect the censorship resistance of Bitcoin.
Mining Pool Protocol
Our above discussion basically treats mining pools and miners as a group. discussion, but in fact they also need division of labor and collaboration. The mining pool concentrates the computing power of miners for mining and distributes rewards based on the computing power contribution. This collaboration process requires some agreements to cooperate.
In currently common mining pool protocols, such as Stratum v1, mining pools only need to distribute a block template (including block header and coinbase transaction information) to miners. Hash operations are performed based on this template. There are currently some tools, such as stratum.work, which can visually see the Stratum information of each mining pool. It can be seen that in this process, miners cannot choose which transactions to package. Instead, the mining pool selects the transactions and builds a template to issue tasks to the miners.
So in the Stratum v1 protocol, we can also roughly benchmark it to the Ethereum ecosystem: mining pool
What will happen in the future
Some promising solutions have been developed or are in progress to reduce the negative impact of MEV on Bitcoin.
New protocols and implementations
In some new mining pool protocols, such as Stratum v2, BraidPool etc. Miners can also choose the transactions to be packaged independently. Currently, Stratum v2 has been adopted by some mining pools (such as DEMAND) and mining machines (such as Braiins), allowing individual miners to build their own block templates, improving the security, decentralization and efficiency of data transmission, while easing transaction review Bitcoin MEV risks.
Therefore, according to this trend, the division of labor between mining pools and miners in the future may not evolve in the same way as the division of labor in Ethereum PBS.
In addition, Bitcoin Core’s new design related to the transaction pool may also bring new changes, mainly including the currently most discussed v3 transaction relay strategy and group. Transaction pool (cluster mempool), etc. However, the impact of these new designs, such as the exit implementation of current Lightning Network channels, is still being discussed.
The impact of the reduction in mining rewards
The reduction in mining rewards cannot be ignored. As block rewards are further reduced in the future, there may be various impacts on the network.
Some issues have been noticed and discussed by Bitcoin developers earlier, such as the fee sniping problem. Mining pools may deliberately remine previous blocks to obtain Transaction fees. Bitcoin Core has some implementations to prevent fee sniping, but the current methods are not perfect yet.
In addition to native handling fees, alternative assets may also be a channel to subsidize mining rewards in the future. Therefore, there are also some projects trying to build some infrastructure, such as Rebar, which builds an alternative public mempool to better identify alternative asset transactions with value.
However, as discussed in the "Out-of-band Payments" section, it remains to be seen what impact these non-Bitcoin-native economic incentives will have on Bitcoin's self-consistent incentive-compatible system. Further observations to come.
In any case, MEV on Bitcoin may not only borrow from Ethereum, but it will also be very different due to factors such as architecture and design philosophy. Bitcoin’s growing utility, decreasing block subsidy rewards, and the growing BTCFi ecosystem are all factors that will focus attention on MEV in the future.
Special thanks
Thank you A Jian for your review and suggestions on this article!