Giá trị có thể trích xuất của thợ mỏ (MEV) và tiền có thể lập trình: Tốt, xấu và xấu

By Bitcoin Tạp chí - 3 tháng trước - Thời gian đọc: 11 phút

Giá trị có thể trích xuất của thợ mỏ (MEV) và tiền có thể lập trình: Tốt, xấu và xấu

Cốt lõi của Bitcoin’s security model relies on this basic game theory—miners, armed with their digital pickaxes, are in a relentless chase for profit. And it’s this pursuit that keeps the network secure. Basic vanilla mining involves producing blocks to earn the block rewards and transaction fees, but have you ever considered that miners might have other ways to extract value from the blockchain beyond this standard mining process? Are there other avenues for profit on the blockchain where miners can leverage their unique position as validators?

MEV là gì?

Trong các hệ thống bằng chứng công việc, “Giá trị có thể trích xuất của thợ mỏ"(MEV) là thuật ngữ mô tả lợi nhuận mà người khai thác có thể kiếm được bằng cách thao túng cách ưu tiên, loại trừ, sắp xếp lại hoặc thay đổi các giao dịch trong các khối mà họ khai thác. Tuy nhiên, kể từ khi Ethereum nâng cấp lên Ethereum 2.0, chuyển mạng sang bằng chứng cổ phần, khái niệm MEV đã mang một tên mới và hiện được gọi là “Giá trị có thể trích xuất tối đa” trong các hệ thống bằng chứng cổ phần. Trong bối cảnh này, chính những người đề xuất khối thay vì người khai thác—là người xác thực—có cơ hội trích xuất giá trị này.

Công cụ khai thác (hoặc trình xác thực trong Ethereum) có vai trò đặc biệt trong các mạng này xác nhận các giao dịch theo khối. Vị trí của họ đặt họ đi trước những người dùng khác một bước và cho phép họ xác định thứ tự giao dịch cuối cùng trong chuỗi. Bên trong một khối, các giao dịch thường được đặt hàng với mức phí cao nhất ở trên cùng, nhưng thỉnh thoảng lại có cơ hội mở ra cho phép các nhà khai thác thực hiện lợi nhuận bổ sung bằng cách thay đổi chiến lược thứ tự giao dịch vì lợi ích riêng của họ.

Bạn có thể nghĩ, có hại gì khi cho phép thợ mỏ kiếm thêm một chút lợi nhuận từ đầu? Mối lo ngại chỉ bắt đầu nảy sinh khi một số thợ mỏ này, những người được trang bị khả năng phân tích tiên tiến hơn và khả năng tính toán mạnh hơn, có thể xác định và khai thác các cơ hội lợi nhuận MEV hiệu quả hơn những người khác.

These opportunities might not always be easy to spot, but the more value that can be extracted through analyzing the chain, the stronger the incentive becomes for research teams equipped with bots to do this work. Over time, this disparity in miner's profit-making ability creates a trend toward centralization within the network. Ultimately undermining the core principle of the blockchain: decentralization.

This is exactly the scenario the Bitcoin developer community is aiming to prevent when considering how best to manage more expressivity on Bitcoin.

Tại sao chúng ta muốn tiền có thể lập trình được?

Trong lịch sử, Bitcoin has operated with relatively simple smart contracts. However, this model struggles with even moderately complex transactions. Bitcoin Script can only validate authentication data, it doesn’t have the capability to impose speed limits on transactions or define coin destinations because Bitcoin Script doesn’t have access to transaction data.

As a somewhat separate issue, working with and writing Bitcoin smart contracts can be challenging for users who don't fully grasp its security requirements. A proposed feature, known as ‘vaults,’ aims to solve some of these pain points by introducing time-locked conditions for transactions. Essentially, vaults could serve as an emergency “escape hatch,” allowing users to recover their funds in the event of compromised private keys. But features like this are only possible with more expressivity.

Ethereum is widely recognized for its highly expressive scripting capabilities, but it also notably struggles with the issue of MEV. Most users generally assume that Bitcoin has no MEV, in stark contrast to Ethereum, which is viewed as a wild frontier for it. But is this the full story?

Các hợp đồng thông minh có tính biểu cảm cao hơn có tự động khuyến khích nhiều kịch bản MEV hơn không?

Có một số yếu tố góp phần tạo nên MEV: (1) tính minh bạch của mempool, (2) tính minh bạch của hợp đồng thông minh và (3) tính biểu cảm của hợp đồng thông minh. Mỗi yếu tố này sẽ mở ra các kênh mới cho MEV, chúng tôi sẽ xem xét từng yếu tố tại đây.

Nhược điểm: (1) Tính minh bạch của Mempool

Như Bitcoin's mempool, the mempools of most blockchains are fully transparent, open, and visible, so that everyone can see what transactions are pending before being validated and confirmed in a block. Bitcoin blocks typically take about 10 minutes to find, which theoretically gives miners that same amount of time to take advantage and front-run.

In practice, on Bitcoin, this isn’t a source of MEV for a few reasons: (1) Bitcoin transactions are simple enough that no miners have a significant analytic advantage over other miners, and (2) Bitcoin transactions generally don’t execute multi-asset transactions such as swaps or open trades that could be front-run.

Ngược lại điều này với Ethereum, nơi có một số giao dịch đa tài sản phức tạp nhất diễn ra trên các sàn giao dịch phi tập trung công cộng (DEX). Thời gian tạo khối chính thức trên Ethereum là 15 giây, nhưng trong thời gian lưu lượng truy cập mempool cao, phí gas cần thiết để đưa khối ngay lập tức có thể dễ dàng vượt quá một trăm đô la. Kết quả là, các giao dịch có mức phí thấp hơn sẽ phải chờ vài phút hoặc thậm chí hàng giờ trước khi được đưa vào một khối. Điều này có thể mở rộng cơ hội cho những cơ hội bất chính chạy trước này, vốn đã phổ biến hơn trên Ethereum do giá trị đáng kể được gói gọn trong các token lớp 2.

Nhược điểm: (2) Tính minh bạch của hợp đồng thông minh

In Bitcoin “smart contracts” are the simple locking and unlocking mechanism inherent in Bitcoin Script. The transaction values, sender, and receiver details are all publicly visible on the blockchain. While this complete and naked transparency isn’t ideal from a privacy perspective, it’s part of how Bitcoin allows all participants in the network to verify the full state of the blockchain. Any observer can analyze these contract details, potentially opening the door to certain MEV-related strategies.

Tuy nhiên, Bitcoin scripting language is, by design, quite limited, focusing primarily on the basic functions of sending and receiving funds, and validating transactions with signatures or hashlocks. This simplicity inherently limits the scope for MEV strategies on Bitcoin, making such opportunities relatively scarce compared to other chains.

Platforms like Ethereum, Solana, and Cardano also have fully transparent smart contracts, but they diverge from Bitcoin by also having highly complex and expressive scripting languages. Their Turing-complete systems make it possible to theoretically execute virtually any computational task which has come to include: self-executing contracts, integration of real-world data through oracles, decentralized applications (dApps), layer-2 tokens, swaps within DEXs, and automated market makers (AMMs). These come together to foster a rich environment for MEV opportunities. Zero-knowledge-proof-based schemes, such as STARKex, could theoretically avoid some of these issues, but this trade-off would come with other complexities.

Điều xấu: (3) Tính biểu cảm của hợp đồng thông minh

The MEV opportunities are so lucrative on some chains that there are “MEV trading firms” bringing in “high five figures, mid six figures” in profits a month. This trend has become so prominent that there are public dashboards dedicated to scanning for profitable opportunities on Ethereum and Solana. Their profitability is generated by executing the full basket of MEV strategies: front-running, sandwich trading, token arbitrage, back-running, and liquidations to name a few. Each exploiting a different smart contract dynamics for profit.

Một số chiến lược MEV này áp dụng cho cả lớp 1 và lớp 2.

Generalized Front-Running: Bots scan the mempool for profitable transactions, and then front-run the original transaction for a profit.Sandwich Trading: The attacker places orders both before and after a large transaction to manipulate asset prices for profit. This strategy leverages the predictable price movement caused by the large transaction.

Sau đó, một số chiến lược nhất định là dành riêng cho mã thông báo lớp 2 và hợp đồng thông minh.

Arbitrage Across Different DEXs: Bots exploit price differences for the same asset on various DEXs by buying low on one and selling high on another.Back-running in DeFi Bonding Curves: MEV bots capitalize on predictable price rises in DeFi bonding curves by placing transactions immediately after large ones, buying during uptrends, and selling for profit. DeFi Liquidations: MEV bots spot opportunities in DeFi lending where collateral values fall below set thresholds, allowing validator's to prioritize their transactions for buying the liquidated collateral at lower prices.

Sự phức tạp của hợp đồng góp phần đáng kể vào những thách thức liên quan đến MEV.

Re-entrancy Attacks: These attacks exploit smart contract logic flaws, allowing attackers to repeatedly call a function before the first execution completes, extracting funds multiple times. In the context of MEV, skilled individuals can significantly profit from this, particularly in contracts with substantial funds.Interconnected Contracts and Global State: On platforms like Ethereum, smart contracts can interact, leading to chain reactions across several contracts from a single transaction. This interconnectivity enables complex MEV strategies, where a transaction in one contract may impact another, offering a chain reaction of profit opportunities.

Một phần của vấn đề ở đây là tổng giá trị được tạo bởi token và dApps được xây dựng trên lớp 2 thường vượt quá giá trị tài sản gốc của blockchain trên lớp 1, làm suy yếu động lực của người xác thực trong việc chọn và xác nhận giao dịch hoàn toàn dựa trên phí.

Tệ hơn nữa, nhiều cơ hội trong số này không bị giới hạn nghiêm ngặt đối với những người xác thực mạng. Những người tham gia mạng khác có bot quét MEV có thể cạnh tranh để có những cơ hội tương tự, gây tắc nghẽn mạng, tăng phí gas và tăng chi phí giao dịch. Kịch bản này tạo ra ngoại tác tiêu cực cho mạng và người dùng, những người đều bị ảnh hưởng bởi phí giao dịch cao hơn, vì chuỗi trở nên kém hiệu quả hơn và hoạt động tốn kém hơn. MEV trong DeFi phổ biến đến mức người dùng gần như chấp nhận nó như một loại thuế vô hình đối với mọi người trong mạng.

Liệu những cơ hội MEV này có tự nhiên xuất hiện như một sản phẩm phụ của các hợp đồng thông minh có tính biểu cảm cao hay có một con đường thay thế nào cho giấc mơ về tiền được lập trình hoàn toàn?

Short of avoiding protocols with highly expressive smart contracts and layer-2 tokens, users can avoid some of these risks by utilizing protocols that support Giao dịch bí mật, like Liquid, that conceal transaction details. But unlike these platforms with more expressive scripting languages, Bitcoin lacks the ability to do things you would expect to be able to do with programmable money.

Điều tốt: Sự đánh đổi để có được tiền có thể lập trình

When considering the evolution of smart contracts on Bitcoin the options we’re given are to (1) push the complexity off-chain, (2) cautiously integrate narrow or limited covenant functionalities, or (3) embrace the path of full expressivity. Let’s explore some of the proposals from each of these options.

(1) Cấu trúc mới cho các hợp đồng ngoài chuỗi: ANYPREVOUT

Off-chain solutions, like the Lightning Network, aim to enhance Bitcoin’s scalability and functionality without burdening the mainchain, keeping transactions fast and fees low. This all sounds good so far.

SIGHASH_ANYPREVOUT (APO) là đề xuất về một loại khóa công khai mới cho phép thực hiện một số điều chỉnh nhất định đối với giao dịch ngay cả sau khi giao dịch được ký. Nó đơn giản hóa cách cập nhật giao dịch, cho phép các giao dịch tham chiếu đến các UTXO trước đó dễ dàng hơn, giúp các kênh Lightning Network nhanh hơn, rẻ hơn, an toàn hơn và đơn giản hơn, đặc biệt là trong việc giải quyết tranh chấp.

Under the hood, APO is a new proposed type of sighash flag. Every Bitcoin transaction must have a signature to prove it’s legitimate. When creating this signature, you use a “sighash flag” to determine which parts of the transaction you’re signing. With APO a sender would sign all outputs and none of the inputs, to commit the outputs of the transaction, but not specifically which transaction the funds are going to come from.

APO enables Eltoo, allowing users to exchange pre-signed transactions off-chain. However APO may inadvertently introduce MEV by making transactions reorderable. As soon as you allow a signature that’s binding the transaction graph you have the ability to swap out transactions. Inputs can be swapped, as long as the new inputs are still compatible with the signature.

(2) Giao ước: CAT + CSFS và CTV

Các giao ước sẽ cho phép người dùng kiểm soát nơi tiền có thể di chuyển, bằng cách áp đặt giới hạn tốc độ hoặc đặt điểm đến cụ thể cho tiền trong giao dịch. Có hai loại giao ước khác nhau: đệ quy và không đệ quy.

Recursive covenants allow coins to continually return to covenants of the same type.Non-recursive covenants limit this control to the next transaction, requiring the entire future path of the coins to be defined upfront.

CAT + CSFS is a covenant proposal that allows scripts to construct or define certain parts of a future transaction. CHECKSIGFROMSTACK (CSFS) verifies a signature against the data that OP_CAT constructed. By using CSFS to require the signature to match some dynamically constructed format from OP_CAT, we can define how these UTXOs can be spent in the future and create a recursive covenant, albeit clunkily.

OP_CHECKTEMPLATEVERIFY (CTV) là một cách tạo các giao ước không đệ quy. Thay vì xác định và xác minh các phần cụ thể của giao dịch, CTV hạn chế cách chi tiêu tiền mà không chỉ định chính xác địa chỉ tiếp theo mà họ phải đến. Nó định nghĩa một “mẫu” mà giao dịch tiếp theo phải xác nhận.

One risk with recursive covenants might be possible to create a scenario where coins must follow a set of rules that repeat over and over, that get trapped in a loop without a way of getting out. Another is that, because covenants are transparent and self-executing they could open Bitcoin up to some of the MEV strategies we see on other chains.

Tin tốt ở đây là gì?

Tin tốt là những đề xuất này đều mang lại tính biểu cảm mới!

Bây giờ mức độ biểu cảm tối đa mà chúng ta có thể nhận được là bao nhiêu?

(3) Tính biểu cảm đầy đủ: Sự đơn giản

Đơn giản is a blockchain-based programming language that differs from other scripting languages in that it is very low-level. It is not a language on top of Bitcoin Script or a new opcode within it, it’s an alternative to it. Theoretically, it’s possible to implement all covenant proposals within Simplicity, and implement many of the other contracts cypherpunks want from programmable money, but with less of the negative externalities of Ethereum.

Simplicity maintains Bitcoin’s design principle of self-contained transactions whereby programs do not have access to any information outside the transaction. Designed for both maximal expressiveness and safety, Simplicity supports formal verification and static analysis, giving users more reliable smart contracts.

Compare Simplicity to: (1) bitcoin covenant proposals and (2) scripting languages on other blockchains:

The covenant proposals on Bitcoin Script, though much simpler than Simplicity, lack the expressivity to handle fee estimation in Script, due to Bitcoin's lack of arithmetic functions. There is no way to multiply or divide, no conditionals or stack manipulations opcodes; it is also very hard to estimate a reasonable fee to be associated with a given contract or covenant. Users end up with spaghetti code, where 80% of their contract logic is dedicated to trying to determine what their fee rate should be. Making these covenant contracts super complicated and difficult to reason about.

The EVM has looping constructs which makes static analysis of gas usage very difficult. Whereas with Script or Simplicity, you can just count each opcode, or recursively add up the cost of each function. Because Simplicity has a formal model, you can formally reason about program behavior. You can't do this with Script even though you can do static analysis of resource usage.

Sự đơn giản sẽ cung cấp cho người dùng mức độ biểu đạt cao nhất, cùng với các tính năng có giá trị khác như phân tích tĩnh và xác minh chính thức. Người dùng được khuyến khích, mặc dù không bị hạn chế, xây dựng các hợp đồng thông minh có khả năng chống lại MEV. Ngoài ra, sự kết hợp của nhiều hợp đồng khác nhau có thể làm phát sinh MEV, ngay cả khi riêng lẻ thì không. Điều này thể hiện một sự đánh đổi cơ bản.

The idea of advancing Bitcoin’s smart contract functionality is undeniably promising and exciting. But it’s important to acknowledge that all these proposals carry some degree of MEV risk—albeit likely not to the extent that we see on other chains. As we think about bringing more programmable money to Bitcoin, there are questions we have to ask:

Can we build a protocol with zero MEV risk, or is this an unattainable ideal?Given the inherent risks of MEV in many proposals, what level of MEV risk is acceptable?And finally, what represents the simplest proposal that offers the greatest degree of expressivity?

Mỗi đề xuất đều có những ưu điểm và nhược điểm riêng. Tuy nhiên, bất kể chúng ta đi theo hướng nào, chúng ta phải luôn đặt mục tiêu ưu tiên bảo mật và đề cao nguyên tắc phân cấp.

Để biết thông tin cập nhật chi tiết và biết thêm thông tin, hãy theo dõi Nghiên cứu dòng khối 𝕏 nguồn cấp dữ liệu.

Đây là một bài viết của khách Kiara Bickers. Các ý kiến ​​được bày tỏ hoàn toàn là của riêng họ và không nhất thiết phản ánh quan điểm của BTC Inc hoặc Bitcoin Tạp chí.

Nguồn chính thức: Bitcoin Tạp chí