Vitalik’s latest blog post: multi -dimensional GAS pricing discussion

Author: Vitalik, founder of Ethereum; Translation: 0xjs@作 作 作 作 作 作 作

In Ethereum, until recently, resources are limited, and a single resource price called “GAS” is used.GAS is the amount of “calculation” required for a given transaction or block.GAS integrates various types of “effort” together. The most noteworthy is:

  • Original calculation (such as add, multiply)

  • Read and write to Ethereum storage (such as SSTORE, SLOADETH transfer)

  • Data bandwidth

  • The cost of generating ZK-SNARK for generating blocks

For example, the transaction I sent (https://etherscan.io/tx/0xc5195b64cc333B8098d71FBD032E05D4545917E3BE8D123AB06E1AD7998E)))A total of 47,085 GAS spent.This is a “basic cost” divided into (i) 21000 GAS.For the generation log of 2149 GAS, the rest is used for EVM execution.The transaction fee that users must pay is directly proportional to the GAS consumed by the transaction.A block can contain up to 30 million GAS, and the GAS price is continuously adjusted through the EIP-1559 target mechanism to ensure that the block contains an average of 15 million GAS.

This method has a main efficiency: because everything is merged into a virtual resource, it leads to a very simple market design.Optimized transactions are easy to minimize costs. Optimized blocks to collect as much as possible (excluding MEV), and there are no strange incentives to encourage some transactions to bundle binding with other transactions to save costs.

butThere is also a major inefficient problem in this method: it regards different resources as mutual conversion, but the actual potential limit that the network can handle is not the case.One way to understand this problem is to see this picture:

GAS limits the following constraints: x1*data+x2*computation & lt; n.The actual underlying security constraints are usually closer to MAX (X1*Data, X2*Computation) & lt; n.This difference causes GAS to restrict unnecessary exclusion of actual security blocks, or accept the actual unsafe blocks, or a certain mix of the two.

If there is a resource with different security restrictions, then the one -dimensional GAS may reduce the throughput of up to one factor?Therefore, people have long been interested in the concept of multi-dimensional GAS for a long time. Through EIP-4844, we actually operated multi-dimensional GAS on Ethereum today.This article discusses the benefits of this method and the prospects of further enhancing this method.

Blobs: Multi -dimensional GAS in Dencun

Earlier this year, the average block size of Ethereum was 150 kb.A large part of this size is rollup data: For security reasons, the 2nd layer protocol stores the data on the chain.These data are very expensive: Although the cost of rollup transactions is about 5-10 times lower than the corresponding transactions on the Ethereum L1, this cost is still too high for many cases.

Why not reduce the cost of callData (currently 16 GAS per non -number byte and 4 gas per number of bytes), so that rollup is cheaper?We have done this before, and we can do it again.The answer here is: the block size in the worst case is 300,000/16 = 1875000 non -number bytes, and the network is almost impossible to deal with the block of this size.If the cost is reduced by 4 times, the maximum capacity will be increased to 7.5 MB, which will bring huge security risks.

This problem is finally solved by introducing a separate data space (called “blob”) by introducing a separate easy Rollup data space in each block.These two resources have different prices and different restrictions: After the Dencun hard fork, a Ethereum block can include a maximum of (i) 30 million GAS, and (ii) 6 BLOB. Each BLOB can include about 125KB call data.Both resources have a separate price. It is adjusted by a separate pricing mechanism similar to the EIP-1559 pricing mechanism. The goal is to use an average of 15 million GAS and 3 BLOB each block.

As a result, the cost of Rollups has been reduced by 100 times, and the transaction volume on ROLLUPS has increased by more than 3 times, and the theoretical maximum block size has only increased slightly: from about 1.9 MB to about 2.6 MB.

Rollup trading fee is provided by GROWTHEPIE.XYZ.Dencun fork occurred on March 13, 2024, and introduced multi -dimensional pricing Blob.

Multi -dimensional GAS and stateless client

In the near future, similar problems with storage certificates without a state -free client will also occur.A stateless client is a new type of client that can verify the blockchain without having to store a lot or any data locally.The stateless client implements this by accepting the proof of the Ethereum specific part of the transaction in the block.

A state -free client receives a block and proves the proof of the current value of the specific part of the state (such as account balance, code, storage) involved in the execution of the block execution.This allows nodes to verify the block without any storage itself.

It takes 2100-2600 GAS to store reading at a time, depending on the type of reading, and the storage writing cost is higher.On average, a block will execute about 1,000 storage and reading (including ETH balance check, SSTORE call SLOAD, contract code reading and other operations).However, the theoretical maximum value is 30000000/2100 = 14285 read.The bandwidth load of a state -free client is proportional to the number.

Today, the plan is transferred from the Merkle Patricia tree to the Verkle tree by designing the state tree of Ethereum to support the stateless client.However, the Verkle tree does not have quantum resistance, and it is not the best choice for the updated Stark proof system.Therefore, many people are interested in supporting a state-free client through the dual Merkle tree and Stark-either skip Verkle completely, or after Verkle transitions for a few years, once the Stark becomes more mature, it will be upgraded.

Stark of the binary hash tree has a lot of advantages, but they have a key weakness that it takes a long time to generate: Although the Verkle tree can prove that more than 100,000 value per second, the hash -based Stark is usually only only only the hash -based Stark is usually only only onlyIt can prove thousands of hash per second, proves that each value requires a “branch” containing many hash values.

Considering that from the super optimized certification system (such as Binius and Plonky3) and the special hash (such as Vision-Mark-32), we are likely to be in a period of time in less than a second.The state of individual values ​​is not 14,285.Each block is no problem, but the worst case (may be published by an attacker) will destroy the network.

The “default” method we deal with this situation is to re -priced: make the storage read more expensive, so as to reduce the maximum value of each block to a safer level.However, we have done this many times. If we do it, too many applications will become too expensive.A better method is multi -dimensional GAS: restrictions and charges of storage access, respectively, keep the average usage of 1,000 storage access at each block, but set the limit of each block to 2,000 times.

More common multi -dimensional GAS

Another resource worth considering is the growth of the state: to increase the operation of the Ethereum state, and the whole node will need to hold a complete state.The uniqueness of state growth is that the reason for restricting state growth is exactly long -term continuous use, not peak.Therefore, adding a separate GAS dimension for the increase in state scale increase operation (for example, from zero to non -zero SSTORE, contract creation) may be valuable, but the goal is different: We can set the floating price for specific average usage, but it is not set at all.Restrictions of each block.

This shows one of the powerful characteristics of Multi -vitamin GAS: it allows us to ask the following questions: (i) What is the ideal average usage of each resource and the maximum safety usage of (ii) each block.We do not set the GAS price based on the maximum value of each block, but the average usage. It has 2? Freedom set 2? Parameters, and adjust each item according to the situation of network security.

More complicated cases, such as some accumulated security considerations of two resources, can be processed by making the operating code or resource cost a certain number of gas (for example, from zero to non -zero SSTORE may cost 5,000 stateless client proofGAS and 20000 storage GAS).

The maximum value of each transaction: the weaker but simpler way to get the multi -dimensional GAS

Let X1 is the cost of the data, and X2 is the calculated GAS cost. Therefore, in one -dimensional GAS system, we can write a transaction GAS cost GAS = x1*data+x2*computation

In the new plan, we define the GAS cost of the transaction as: GAS = MAX (X1*Data, X2*Computation)

In other words, the transaction is not charged based on the calculation of data plus, but is charged more based on which resources of the two resources it consume.This can easily expand to cover more dimensions (e.g. Max (…, x3*storage_access)).

It should be easy to see how this increases throughput while ensuring safety.The maximum amount of data in a block is still Gaslimit/X1, which is exactly the same as the one -dimensional GAS solution.In the same way, the theoretical maximum calculation amount is Gaslimi/X2, which is exactly the same as the one -dimensional GAS solution again.However, the cost of any data consumed and calculated transactions will be reduced.

This is about the proposed scheme in the proposed EIP-7623 to reduce the maximum block size and further increase the BLOB count.The precise mechanism in EIP-7623 is slightly more complicated: it maintains the current callData price of 16 GAS, but adds the “reserve price” of 48 GAS per byte;Bytes) higher.Therefore, EIP-7623 reduces the maximum transaction calling data in the block from about 1.9 MB to about 0.6 MB, while maintaining the cost of most applications unchanged.The advantage of this method is that it has changed very little compared with the current one -dimensional GAS solution, so it is very easy to achieve.

It has two disadvantages:

1. Even if all other transactions in the block use only a very little resource, a large number of transactions that occupy a resource will still not need to charge a lot of fees.

2. It inspires data -intensive and calculated dense transactions to a bundle package to save costs.

In my opinion, the Rules of EIP-7623 style can bring enough benefits to transaction calling data or other resources, even if there are these shortcomings, it is worth it.However, if we are willing to invest (significant and higher) development efforts, there is a more ideal method.

Multi-dimensional EIP-1559: More difficult but ideal strategy

Let’s first review the working principle of “conventional” EIP-1559.We will focus on the version introduced by BLOB in EIP-4844 because it is more elegant in mathematics.

We track a parameter, Excess_blobs.During each period, we set up:

Excess_blobs & lt;- Max (Excess_blobs + Len (block.blobs) -Target, 0)

Here target = 3.In other words, if the number of blocks of a block is more than the target, Excess_blobs increases, and if the number of blocks in the block is less than the target, it will decrease.Then we set up blob_basefee = exp (Excess_blobs / 25.47), where EXP is an approximate value Exp (x) of the index function.

In other words, whenever Excess_blobs increases by about 25 times, the basic cost of Blob will increase by about 2.7 times.If the BLOB becomes too expensive, the average usage will decrease, and then Excess_blobs starts to decrease, thereby automatically reduced the price again.Blob’s price is constantly adjusted to ensure that the block is half full -that is, each block contains an average of 3 blobs.

If the amount of usage appears short -term, there will be restrictions: each block can only contain up to 6 BLOB. In this case, transactions can compete with each other by increasing priority fees.However, under normal circumstances, each blob only needs to pay blob_basefee and add a little additional priority fee as an inspiration.

This GAS pricing has been in Ethereum for many years: as early as 2020, the EIP-1559 introduced a very similar mechanism.Through EIP-4844, we now have two separate GAS and blobs floating prices.

The basic cost of GAS within one hour on May 8, 2024, the unit is GWEI.Source: Ultrasonic.Money

In principle, we can add more solo costs to storage reading and other types of operations, but there is a warning that I will explain it in detail in the next section.

For users, this experience is very similar to today: you no longer pay a basic fee, but pay two basic costs, but your wallet can abstract it from you, only show you that you can expect you to expectPayment expected expenses and maximum expenses.

For block builders, most of the time the best strategy is the same as today: including any effective content.Most blocks are not full -whether it is GAS or BLOB.A challenging situation is that when there is sufficient GAS or enough blobs to exceed block restrictions, the builder needs to potentially solve the multi -dimensional KnApsack problem to maximize its profits.However, even if there are quite a good approximation algorithm, in this case, the benefits obtained by optimizing the profit by formulating the proprietary algorithm are much smaller than using MEV for the same operation.

For developers, the main challenge is to redesign the functions of EVM and its peripheral infrastructure. These infrastructures are currently designed around one price and one restricted design, and design to adapt to multiple prices and multiple restrictions.One problem faced by application developers is that optimization becomes slightly difficult: in some cases, you can no longer clearly say that A is more efficient than B, because if A uses more calldata and B is used more execution, then then more execution, thenWhen callData is cheap, it is more expensive when CALLDATA is expensive.However, developers can still get quite good results by optimizing the long -term historical average price.

Multi-dimensional pricing, EVM and sub-calls (sub-calls)

One problem will not appear in BLOB, nor does it appear in EIP-7623, or even in the “complete” multi-dimensional pricing implementation of CALLDATA, but if we try to pricing status or any other resources, we try to pricing status or any other resources.This problem will occur: the GAS limit in the child call.

GAS in EVM is limited to two places.First of all, each transaction is set up with a GAS limit, which limits the total amount of GAS that can be used in the transaction.Secondly, when one contract calls another contract, the call can set its own Gas Limit.This allows the contract to call other contracts they do not trust, and still guarantee that they still have the remaining GAS after calling to perform other calculations.

The trace of the account abstract transaction, one of the accounts calls the other account, and only provides the caller with a limited number of GAS to ensure that even if the call consumes all the GAS assigned to it, the external call can continue to run.

The challenge is: GAS becomes multi -dimensional between different types of execution. It seems that child calls need to be called to provide multiple limits for each type of GAS.compatible.

This is one of the reasons why the multi -dimensional GAS proposal usually stays in two dimensions: data and execution.Data (whether trading is CALLDATA or BLOB) is only allocated outside the EVM, so there is no need to change the content inside the EVM to make the callData or blob priced separately.

We can come up with a “EIP-7623 solution” to solve this problem.This is a simple implementation: during the implementation, the cost of charging the storage operation is 4 times; in order to simplify the analysis, we assume that each storage operation is 10,000 GAS.At the end of the transaction, the refund min (7500 * storage_operations, execution_gas).As a result, after deducting the refund, the user needs to pay the following expenses:

Execution_GAS + 10000 * Storage_operations -Min (7500 * Storage_operations, Execution_GAS)

This is equal to:

MAX (Execution_GAS + 2500 * Storage_operations, 10000 * Storage_operations)

This reflects the structure of EIP-7623.Another method is to track the storage_operations and execution_gas in real time, and the amount of 2500 or 10000 gas is charged by the MAX (Execution_GAS + 2500 * Storage_operations, 10000 * Storage_operations) according to the call operation code.This avoids the transaction that requires excessive allocation of Sky GAS, and these GASs are mainly recovered by refunds.

We have not obtained a fine -grained license for sub -calls: sub -calls may consume all the “allowances” of transactions for cheap storage operations.But we do get enough good things. Among them, sub -call contracts can set up limits and make sure that once the child calls are completed, the main call is still sufficient GAS to perform any post -processing it needs to be executed.

The simplest “complete multi -dimensional pricing solution” I can think of is: we regard the sub -call of the child calling GAS as a proportion.In other words, assuming it

? Different types of execution, each transaction sets a multi -dimensional limit? 1 … ??.Assuming the current execution point, the remaining GAS

For? 1 … ??.Assuming that Call calls an operating code with a sub -call Gas Limit S.Let S1 = S, and then S2 = S1/G1*G2, S3 = S1/G1*G3, etc.

In other words, we regard the first type of GAS (in fact the execution of a virtual machine) as a privilege “account unit”, and then assign other types of GAS so that the child can be called in each type.Gas.This is a bit ugly, but it maximizes backward compatibility.If we want the scheme to be more “neutral” between different types of GAS, at the cost of sacrificing backwardness, we can simply let the child call the Gas Limit parameter represent a small part of the remaining GAS (for example [1 …63] / 64).

However, in any case, it is worth emphasizing that once the introduction of multi -dimensional execution of GAS, the inherent ugliness will increase, which seems difficult to avoid.

Therefore, our task is to make a complex trade -off: whether we accept some of the ugly things at the EVM level, so as to safely release the significant L1 scalability income.And application developers?

It is likely that it is not any one I mentioned above, and there is still room for more elegant and better things.

Thank you for feedback and review of Ansgar Dietrichs, Barnabe Monoton and Davide Crapis.

  • Related Posts

    The potential of Ethereum is not only passed in the spot ETF

    Jessy, Bitchain Vision Realm Regarding Ethereum’s unanimous sings and decline, a transformation occurred after the Ethereum spot ETF passed. It is reported that the probability of Ethereum’s spot ETF passed…

    Ethereum governance reflection: Why are you dissatisfied with the EIP-3074 incident?

    Source: Buyu said This article explains my thinking on the recent EIP-3047 incident, thanks to Vitalik and YOAV for review of content. If you don’t know this incident,Let’s review it…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    From traditional replication to innovation Can Backpack seize the future?

    • By jakiro
    • March 26, 2025
    • 25 views
    From traditional replication to innovation Can Backpack seize the future?

    Saylor’s $200 trillion BTC strategy: U.S. BTC domination and immortality

    • By jakiro
    • March 26, 2025
    • 26 views
    Saylor’s $200 trillion BTC strategy: U.S. BTC domination and immortality

    Ethereum’s two major upgrades to Pectra and Fusaka are explained in detail. What will be brought to ETH?

    • By jakiro
    • March 26, 2025
    • 25 views
    Ethereum’s two major upgrades to Pectra and Fusaka are explained in detail. What will be brought to ETH?

    Coingecko: How do investors view the potential of crypto AI technology?

    • By jakiro
    • March 26, 2025
    • 60 views
    Coingecko: How do investors view the potential of crypto AI technology?

    Galaxy: Research on the current situation of Futarchy governance system and on-chain forecast market

    • By jakiro
    • March 26, 2025
    • 19 views
    Galaxy: Research on the current situation of Futarchy governance system and on-chain forecast market

    The latest updates from ETH and Solana: What are the things to pay attention to?

    • By jakiro
    • March 25, 2025
    • 22 views
    The latest updates from ETH and Solana: What are the things to pay attention to?
    Home
    News
    School
    Search