Gas Fee refers to the need for blockchain users to verify with the network when performing transactions or interacting with smart contracts. Fees paid by users are generally paid in the form of native assets 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 - reducing the cost of users maliciously sending spam transactions. high.
The term Gas was originally coined by Ethereum. According to the Ethereum developer page, "Gas is the fuel that makes Ethereum run, just like a car needs gasoline to run."
Some other blockchain networks follow the usage of Gas Fee (such as Polygon, BNB Chain, etc.), and some may call these transaction fees, miner fees, or other similar fees (such as Bitcoin, Litecoin, etc.). But essentially they are fees paid by users to network validators in order to execute transactions.
Different networks have different Gas Fee calculation methods. Let’s take Ethereum as an example: Total Fee = Gas limit * ( Base fee + Priority fee)
Note: The above calculation method is the current calculation method after the London upgrade of the Ethereum network in August 2021. To understand the calculation method before the London upgrade, please refer to EIP-1559 .
Suppose we set the Gas Limit to 50,000 and execute an $ETH transfer transaction. The network validator will consume 21,000 Units of Gas, and the remaining 29,000 will be returned.
Assuming we set the Gas Limit to 20,000, the network validator will still consume 20,000 Units of Gas in an attempt to complete the transaction, but due to insufficient Gas Units, the transaction will not be confirmed. But since the validator has completed work worth 20,000 Gas Units, these 20,000 Gas Units will be consumed and will not be returned.
When transacting and paying Gas Fee in Ethereum, we can often see the word Gwei as the unit of Gas Fee, then Gwei is what.
When designing Ethereum, $ETH was designed to be split into a minimum of 1,000,000,000,000,000,000 shares (18 zeros). To facilitate calculation, the minimum split unit was set to the unit of measurement wei. Later, since Gas Fee is usually much less than 1 $ETH, Gwei (gigawei) was set as the unit of measurement used to express Gas Fee. giga means gigabyte (as in gigabyte-GB, gigabyte), 1 $ETH = 1,000,000,000 Gwei (9 zeros)