Vitalik's new article: Multi-dimensional Gas pricing will bring wider applications
Original title: Multidimensional gas pricing
Original author: Vitalik Buterin
Original translation: Asher, Odaily Planet Daily
In the Ethereum network, resources are limited and priced through a single resource called "Gas". Gas is a measure of the "computational effort" required to process a specific transaction or block. Gas incorporates multiple types of "effort", the most important of which are:
· Raw computation (such as ADD, MULTIPLY)
· Reading and writing Ethereum storage (such as SSTORE, SLOAD, ETH transfers)
· Data bandwidth
· The cost of generating block ZK-SNARK proofs
For example, this transaction cost a total of 47085 Gas. This includes: (i) a "base fee" of 21,000 Gas; (ii) 1,556 Gas for the calldata bytes that are part of the transaction; (iii) 16,500 Gas for reading and writing storage; (iv) 2,149 Gas for logs; and the rest for EVM execution. The transaction fee that a user must pay is proportional to the Gas consumed by the transaction. A block can contain a maximum of 30 million Gas, and the Gas price is constantly adjusted through the EIP-1559 target mechanism to ensure that blocks contain an average of 15 million Gas.
Demonstration Case
This approach has a major advantage: since all transactions are merged into a single virtual resource, market design is very simple. It is easy to optimize transactions to minimize costs, it is relatively easy to optimize blocks to charge the highest possible fees (excluding MEV), and there are no strange incentives to encourage certain transactions to be bundled with other transactions to save fees.
But this approach also suffers from a major inefficiency: it treats different resources as convertible into each other, when the actual fundamental limits on what the network can handle are not. One way to understand this problem is to look at the following diagram:
If there are clear safety limits on the n resources, then one-dimensional Gas could reduce throughput by up to a factor of n. As a result, there has been a long-standing interest in the concept of multi-dimensional Gas, and with EIP-4844, we can actually use multi-dimensional Gas on Ethereum today. This post explores the benefits of this approach, and the prospects for improving it further.
Blobs: Multidimensional Gas after Cancun
At the beginning of the year, the average block size was 150 kB. A large portion of this was calldata: L2 protocols that store data on-chain for security purposes. This data is expensive: while transactions on calldata are 5-10x cheaper than corresponding transactions on Ethereum L1, even this cost is prohibitive for many use cases.
This problem was ultimately solved by introducing a separate, calldata-friendly space in each block, called "Blobs".
After Cancun, an Ethereum block can contain at most (i) 30 million Gas and (ii) 6 Blobs, each of which can contain about 125 kB of calldata. Both resources have independent prices, regulated by independent pricing mechanisms similar to EIP-1559, targeting an average of 15 million Gas and 3 Blobs per block.
Thus, convolution is 100x cheaper, and convolution transactions are more than 3x larger, while the theoretical maximum block size has only increased slightly: from 1.9MB to 2.6MB.
Rolling transaction fees, courtesy of growthepie.xyz. The Dencun fork occurred on March 13, 2024, and introduced multi-dimensionally priced Blobs
Multi-dimensional Gas and Stateless Clients
In the future, stateless clients will face the problem of storage proof. Stateless clients are a new type of client that is able to verify the blockchain while storing little or no data locally. It accepts proofs to verify the Ethereum state of a specific part of a block without storing any data itself.
A block performs about 1,000 storage read and write operations on average, but the theoretical maximum could be tens of millions. The current plan is to support stateless clients by migrating Ethereum's state tree design from a Merkle Patricia tree to a Verkle tree. However, the Verkle tree is not quantum-resistant and does not work with the newer STARK proof system.
Therefore, many people hope to support stateless clients through binary Merkle trees and STARKs, either skipping Verkle entirely or upgrading a few years after the Verkle migration. Although STARK proofs for binary hash tree branches have many advantages, the slow speed of generating proofs cannot meet the needs of high speed.
It is expected that there will be a time in the future when it is possible to prove 1000 values in less than a second, but it is impossible to prove 14,285 values at the same speed. To address this problem, the concept of multi-dimensional Gas was proposed. This approach can limit and charge storage access separately, ensuring an average of 1000 storage accesses per block, while setting a limit of 2000 per block to improve the security and efficiency of the network.
Wider Applications of Multi-Dimensional Gas
State size growth is another resource to consider. When increasing the size of the Ethereum state, full nodes need to hold more data. Unlike other resources, the limit on state size growth is mainly derived from long-term sustained usage rather than short-term peaks. Therefore, in order to handle operations with state size growth, a separate Gas dimension can be considered. The goal of this approach is to set a floating price that targets a specific average usage rather than setting a limit per block.
This demonstrates the power of multi-dimensional Gas, which allows different questions to be asked for each resource: (i) what is the ideal average usage of each resource; and (ii) what is the safe maximum usage of each resource per block. By setting these parameters, the price of Gas can be adjusted based on the security of the network, rather than based on the maximum usage per block. When dealing with more complex cases, multiple Gas can be used. For example, a zero to non-zero SSTORE operation may require the consumption of different types of Gas, such as stateless client proof Gas and storage expansion Gas.
Maximum per transaction: A weaker but simpler strategy for obtaining multi-dimensional Gas
In a single-dimensional Gas system, the Gas cost of a transaction is determined based on the Gas consumed by both data and computation. However, in a multi-dimensional Gas system, the Gas cost can be determined based on the primary resource consumed by the transaction. This approach improves throughput while maintaining security.
EIP-7623 proposed a similar solution, reducing the space taken up by transactions in blocks by increasing the minimum price per byte, but this also led to some problems, such as individual resource-intensive transactions still having to pay high fees, and also created an incentive for data-intensive and compute-intensive transactions to be bundled together to save costs. While this approach has its limitations, the benefits are worth it, but there are more ideal solutions if you are willing to invest more development work.
Multidimensional EIP-1559: A more difficult but more ideal strategy
At its core, Multidimensional EIP-1559 adjusts the base fee of Blobs by tracking the excess_blobs parameter to ensure that the average usage of blocks remains at a target level.
When a block contains more blobs than the target, the base fee increases to reduce usage, and decreases if it does not. This pricing mechanism allows transaction prices within a block to dynamically adjust to keep the block half-filled. At the same time, short-term spikes in usage will trigger the limit mechanism, ensuring reasonable competition for transactions.
Gas has been priced this way in Ethereum for many years: EIP-1559 introduced a very similar mechanism as early as 2020. With the introduction of EIP-4844, there are now two floating prices for Gas and Blobs.
For users and block builders, the experience is similar to before, but they need to adapt to two separate fees. However, for developers, the need to redesign EVM functionality to adapt to a multi-price and multi-limit environment may add some challenges.
Multi-dimensional pricing, EVM, and subcalls
In the EVM, there are two types of gas limits: a total gas limit set for each transaction, and individual gas limits when contracts call other contracts. This allows contracts to call untrusted contracts while ensuring that there is still gas left after the call for other computations. However, there are challenges in implementing multi-dimensional gas pricing between different types of execution. Such a multi-dimensional scheme would require subcalls to provide multiple limits for each gas type, which would be a profound change to the EVM and incompatible with existing applications.
Multi-dimensional gas proposals typically stop at just two dimensions: data and execution. Data is allocated outside the EVM, so no internal changes are required to price it separately. For developers, this means that the EVM and its surrounding infrastructure need to be redesigned to accommodate multiple prices and multiple limits. In some cases, optimizations will also become more difficult because it is not clear which approach is more efficient, which may affect the development process.
While there are some challenges, these issues can be addressed by implementing something like EIP-7623, which charges an additional fee for storage operations and refunds them at the end of the transaction to ensure that the main call still has enough Gas to perform subsequent operations.
Summary
In either case, it is worth emphasizing that once you start introducing multi-dimensional execution Gas, the complexity of the system will increase significantly, which seems inevitable.
So we are faced with a complex decision: are we willing to accept more complexity at the EVM level in exchange for the significant gains of unlocking L1 scalability, and if so, which specific proposal is better suited to the protocol economy and application developers? It is very likely that the best solution is neither of the ones mentioned previously nor the ones mentioned above, and we still have room to come up with more elegant and effective solutions.
Original link
欢迎加入律动 BlockBeats 官方社群:
Telegram 订阅群: https://t.me/theblockbeats
Telegram 交流群: https://t.me/BlockBeats_App
Twitter 官方账号: https://twitter.com/BlockBeatsAsia
Disclaimer: The content of this article solely reflects the author's opinion and does not represent the platform in any capacity. This article is not intended to serve as a reference for making investment decisions.
You may also like
Altcoin Mania: 5 Coins That Could Turn $500 Into $1M in December 2024!
The price of the rune DOG•GO•TO•THE•MOON exceeded $0.008, with a 24-hour increase of 23.4%.
Bitcoin mining companies’ holdings ranking: Marathon Digital tops the list with 27,562 Bitcoins
Musk publishes a themed video about TERMINUS, the first city on Mars