Understanding Ethereum's Gas Mechanism After EIP-1559

·

Ethereum is often described as a world computer. Its operation consumes resources. To prevent network abuse and downtime from incorrect usage, every transaction operation requires a fee, commonly referred to as "Gas". It represents the computational resources needed to perform operations on the network.

What Is Gas in Ethereum?

Think of Ethereum as a global computational engine. Every action, from simple transfers to complex smart contract interactions, requires energy. This energy is measured in Gas.

Gas acts as a unit of account for the computational effort required. Without it, the network could be overwhelmed by spam or inefficient code.

A simple analogy can help: if the Ethereum network is a worker, then Gas is the labor provided. After the work is done, payment is required. This payment equals the price per unit of labor multiplied by the total labor provided. The price per unit is called GasPrice, which is dynamically determined by the network. Thus, the total cost is Gas Used * GasPrice.

GasLimit is the maximum amount of labor you are willing to pay for. If a task requires 100 units of labor but you only pay for 80, it won’t complete. If you pay for 120 units, the extra 20 is refunded after completion. In Ethereum terms, it’s the maximum Gas you’re willing to spend on a transaction.

A Real Transaction Example

Consider a typical EIP-1559 transaction. You might see the following components:

The transaction type is indicated as "2 (EIP-1559)", following EIP-2718.

What Is the Base Fee?

The Base Fee is a mechanism introduced by EIP-1559 to improve Ethereum’s fee market and user experience. It is a per-block base cost that adjusts dynamically based on network congestion.

The Base Fee algorithm aims to balance supply and demand. When the network is busy, it increases to discourage overuse. When idle, it decreases to encourage activity.

The calculation involves:

The three adjustment scenarios:

  1. Usage equals target: Base Fee remains unchanged.
  2. Usage above target: Base Fee increases.
  3. Usage below target: Base Fee decreases.

The change is calculated using:

BaseFee change = parentBaseFee * (gasUsedDelta / parentGasTarget) / baseFeeChangeDenominator

Where:

This design ensures fees respond smoothly to network demand.

Understanding Max Priority Fee

MaxPriorityFee is a per-Gas tip paid directly to miners. A higher tip incentivizes faster transaction inclusion.

The total GasPrice paid is: BaseFee + MaxPriorityFee.

For example:

This aligns with the transaction fee shown on explorers.

The Role of Max Fee

MaxFee is the maximum price per Gas you are willing to pay. Since Base Fee changes per block, your transaction might not be included immediately. If the Base Fee rises above your MaxFee, the transaction could be dropped.

Setting MaxFee high enough ensures your transaction remains valid for several blocks. A common formula is:

MaxFee = (2 * BaseFee) + MaxPriorityFee

This typically allows inclusion within 6 blocks even if congestion increases.

Burnt Fees Explained

The burnt fee is the portion of the fee destroyed. It equals BaseFee * GasUsed. This mechanism removes ETH from circulation, potentially making it deflationary.

For example:

This amount is sent to an unrecoverable address.

Transaction Savings

Transaction savings show the difference between what you were willing to pay (MaxFee * GasUsed) and what you actually paid ((BaseFee + MaxPriorityFee) * GasUsed).

It represents the refundable amount had the network conditions been worse.

Example:

This is reflected as "Txn Savings" on block explorers.

Using JSON-RPC for Gas Estimates

When sending EIP-1559 transactions, you often need to set gas parameters manually. Ethereum nodes provide RPC methods to help:

eth_estimateGas

Estimates the gas required for a transaction. Useful for setting GasLimit.

Request:

{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [{ ... }],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": "0x5208", // 21000 in hex
  "id": 1
}

eth_maxPriorityFeePerGas

Returns the current suggested priority fee.

Request:

{
  "jsonrpc": "2.0",
  "method": "eth_maxPriorityFeePerGas",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": "0x9b8495", // Priority fee in wei
  "id": 1
}

eth_getBlockByNumber

Fetches block information, including the current Base Fee.

Request:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": ["latest", false],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": {
    "baseFeePerGas": "0x1bc47470a", // Base Fee in wei
    ...
  },
  "id": 1
}

Using these, you can compute:
MaxFee = (2 * BaseFee) + MaxPriorityFee

👉 Explore real-time gas tools

Frequently Asked Questions

What is the main goal of EIP-1559?
EIP-1559 aims to make transaction fees more predictable and improve user experience. It introduces a base fee that adjusts dynamically with network demand, reducing fee volatility. Additionally, burning base fees may positively impact ETH's economic model.

How does Base Fee adjustment work?
The Base Fee changes per block based on whether the previous block's gas usage was above or below the target. The change is capped to prevent sudden spikes, ensuring smooth adjustments.

Why are fees burnt?
Burning the base fee removes ETH from circulation, counteracting inflation from block rewards. This can make ETH potentially deflationary during high network activity.

What happens if my MaxPriorityFee is too low?
If your tip is too low, miners might prioritize other transactions. Your transaction could take longer to confirm or be dropped if the Base Fee exceeds your MaxFee.

How can I estimate fees accurately?
Use RPC methods like eth_estimateGas and eth_maxPriorityFeePerGas. Wallets and explorers often integrate these to provide real-time suggestions.

Can I still use legacy transactions?
Yes, but EIP-1559 transactions are generally more efficient and predictable. Most wallets now default to the new format.

Conclusion

EIP-1559 transformed Ethereum's fee market by introducing variable base fees and burning mechanisms. Understanding Gas, Base Fee, priority tips, and max fees helps users optimize costs. As Ethereum evolves, these mechanisms ensure sustainable and efficient network operation.

👉 Get advanced transaction methods