Ethereum Gas Fee

How does Ethereum Gas Fee Work After EIP-1559?

According to the definition of the halting problem, it becomes challenging to ascertain whether a program will cease execution or continue indefinitely given a specific input [1]. The issue arises when certain programs may execute infinitely on the blockchain, and there is no effective means of identifying them. In order to mitigate the risk of denial of service, Ethereum introduces the gas fee mechanism. This is accomplished by imposing a specific amount of cryptocurrency as a charge for utilizing computing and storage resources. The gas fee is charged regardless of whether the transactions succeed or fail.

The definition of Gas fee is the amount of gas used for operations multiplied by the cost per unit gas. And it consists of the following two parts:

  • base fee: The base fee represents the minimum amount of gas required to cover a valid transaction, with its estimation determined by the protocol and based on the size of the previous block. To prevent sudden spikes or plunges in the fee, there is a maximum limit set on the fluctuation of the base fee, and the ratio is 12.5%. Furthermore, after validators create a block, the base fee is intentionally burned, reducing the circulating supply of the currency.

  • priority fee: The priority fee incentivizes validators to prioritize transaction inclusion. In contrast to the base fee, which is burnt upon block creation, priority fee is distributed to validators as rewards.

The modified gas fee formula can be slightly adjusted to the amount of gas used multiplied by the sum of the base fee and the priority fee.

Users can set the gas limit for a transaction using the maxFeePerGas parameter. This value represents the maximum gas fee they are willing to pay in the transaction. Any difference between the maximum fee and the total of the base fee and priority fee is returned to the sender of the transaction [2].

Blocks are constrained in size by the gas limit contained within each block. This restriction safeguards against arbitrary block sizes that could increase the requirement of full nodes in terms of storage space and processing speed, leading to concerns of centralization. Initially set at 15 million gas, this target block size adjusts dynamically to network demand. The maximum block size is capped at 30 million gas, twice the target size. As the current block size surpasses the target, the base fee increases, and vice versa, leading to the equilibrium between block size and the base fee [3]. The details can be found in the next section.

The gas fee model prior to the London Upgrade followed the first auction mechanism, where the highest bidder would win and pay the exact amount they bid. When the demand for the Ethereum network surged, the only way to ensure the acceptance of a transaction was to increase the gas fee. However, this led to a sharp spike in gas fees, resulting in a poor user experience as users had to wait for their transactions to be processed. EIP-1559, also known as the gas burning proposal, is designed to mitigate such vulnerability and serve the following purposes: (1) Enhance gas fee predictability for users. (2) Reduce transaction processing delays. (3) Improve the user experience with reasonable gas fee pricing. (4) Establish a virtuous cycle between network demand and token supply.

These goals are accomplished through several countermeasures. Firstly, a dynamic block size mechanism is adapted, allowing the maximum block size to increase up to twice its original size, in accordance with network demand. Secondly, gas fee fluctuations are limited to 12.5%, reducing the likelihood of sudden spikes or plunges in gas prices. A detailed illustration is provided in Figure 1: At block N+1, a high network demand emerges, prompting users to raise their priority fees to incentivize validators. Due to this surge in demand, the block size extends in block N+2 to C’, causing the gas fee to rise to P’, where P’ < 1.125 * P. The gas price gradually increases by the constrained 12.5% until users find it too expensive and choose to wait for more reasonable gas fees. Consequently, the gas fees decrease, and the block size returns to its normal state.

Model

Reference:

[1] Halting Problem

[2] GAS AND FEES

[3] BLOCKS

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy