What is Gas fee

Gas Fee refers to the fee paid by users on the blockchain to network validators when executing transactions or interacting with smart contracts. These fees are generally paid in the native asset of the blockchain network.

Gas Fee was originally designed to compensate network validators for the energy consumption required to verify transactions and to provide a layer of security for the blockchain network itself—making it more costly for users to maliciously send spam transactions.

The term Gas was first introduced by Ethereum. According to the Ethereum developer page, “Gas is the fuel that makes Ethereum run, just like gasoline makes a car run.”

Other blockchain networks have adopted the Gas Fee terminology (such as Polygon, BNB Chain, etc.), while some may refer to these as transaction fees, miner fees, or similar charges (such as Bitcoin, Litecoin, etc.), but fundamentally, they are fees paid by users to network validators to execute transactions.

Calculation Method of Gas Fee

Different networks have different methods for calculating Gas Fee. Taking Ethereum as an example: Total Fee = Gas limit * (Base fee + Priority fee)

Gas Fee Calculation

Gas Limit refers to the maximum Gas Units a user is willing to spend on a particular transaction. A Gas Unit measures the amount of computational work required to perform a specific operation on the Ethereum network. The number of Gas Units needed for a transaction is determined by the computational workload involved, so different transactions require different amounts of Gas Units. For example, a standard $ETH transfer transaction requires 21,000 Units of Gas, while transactions involving smart contracts are generally more complex and require more Gas Units.

Base Fee is the minimum Gas Fee required for a transaction to be executed on Ethereum. This value is dynamically adjusted based on the number of users interacting with the network at any given time. The more users interact, the higher the Base Fee. Real-time Base Fee can be viewed on Etherscan Gas Tracker.

Priority Fee is an additional fee voluntarily added by users to expedite the transaction. Ethereum network validators can see which transactions include a Priority Fee. When validators verify a transaction with an attached Priority Fee, they receive this fee. This mechanism encourages validators to prioritize transactions with higher Priority Fees to earn more profit. Conversely, users who want their transactions to be confirmed faster than others need to attach a higher Priority Fee.

Note: The above calculation method is the current method after the Ethereum London upgrade in August 2021. For the calculation method before the London upgrade, please refer to EIP-1559.

Gas Refund Mechanism

Suppose we set the Gas Limit to 50,000 for a $ETH transfer transaction. The network validator will consume 21,000 Units of Gas, and the remaining 29,000 will be refunded.

Suppose we set the Gas Limit to 20,000. The validator will still consume 20,000 Units of Gas attempting to complete the transaction, but due to insufficient Gas Units, the transaction will not be confirmed. However, since the validator has already performed work worth 20,000 Gas Units, this 20,000 Units of Gas will be consumed and not refunded.

Gwei

When conducting transactions on Ethereum and paying Gas Fees, we often see the term Gwei as the unit of Gas Fee. So, what is Gwei?

In the design of Ethereum, $ETH Gwei was created as the smallest divisible unit, which can be split into 1,000,000,000,000,000,000 parts (18 zeros). For ease of calculation, the smallest subdivision unit is set as the measurement unit wei. Later, because Gas Fees are usually much less than 1 $ETH , Gwei (gigawei) was established as the unit for measuring Gas Fees. Giga means billion (similar to gigabyte-GB), so 1 $ETH = 1,000,000,000 Gwei (9 zeros). **$GALA **

ETH1.28%
BNB0.02%
BTC1.57%
LTC1.87%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Repost
  • Share
Comment
0/400
No comments
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate App
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)