As for what Ethereum's Gas is, you can search on Baidu or Google and find that there are many different expressions. Some are interpreted as "...the amount consumed", and some are interpreted as "...the cost consumed". There is currently no unified conclusion. Initially, Scholars tend to be confused.

However, just remember this simple formula: "cost = quantity * price", and you can understand each concept one by one. Let's look at the following example first:

Just like a car needs to consume gas to run, various "applications" in the Ethereum network need to pay Gas to run. In Ethereum, Gas acts like the gasoline needed for a car.

Suppose you want to drive from A to B and need to consume 10 liters of gasoline. The price per liter is 8 yuan. Then the cost of gasoline from A to B is: 10*8=80 yuan.

Similarly, for the Ethereum network, assuming you want to perform an operation, such as sending a token, you need to consume 21,000 units of Gas, and the price of each unit of Gas is 100gwei. Then the fee required to perform this operation is: 21000*100=2100000gwei

In the above example, 21,000 is the Gas consumption quantity (Gas limit), 100 is the Gas price (Gas price), and 2,100,000gwei is the handling fee or Gas fee for this operation. Through the above two examples, we just want to illustrate a simple formula: cost = quantity * price. The calculation of Ethereum's handling fees also follows this formula, and the following explanation will be based on this formula.

1. What is Gas

Gas翻译为中文是燃料/汽油的意思。在以太坊(或其他类似网络)中,Gas是一个专有名词,它代表着执行特定操作所需的燃料。这个燃料类似于汽车需要的汽油,用于支持各种交互操作,如代币发送、存储或代币兑换。所以,经常听到人们说 "Gas 现在是5/Gas,飙到了200/Gas",Gas就是一个专有名词,既不是指数量也不是指价格。
二、什么是Gas Limit

In the initial example, to calculate how much gasoline it costs to run from point A to point B, in addition to knowing the price of gasoline (how much does 1 liter cost), you also need to know the amount of gasoline consumed (how many liters are used).

Similarly, in the Ethereum network, to calculate the cost (handling fee) of a certain operation, in addition to knowing the price of Gas, you also need to know the amount of Gas consumed.

Gas数量要消耗多少,由合约创建者设定,不同合约、不同类型的操作,消耗的gas数量不尽相同,操作越复杂需要消耗的gas越多,所以很难预先估计Ga的消耗量,为此采取的办法是,给定一个比实际消耗更高的限值,即Gas Limit,如果实际未消耗这么多,剩余部分将退回用户。因此,在以太坊网络计算手续费时,消耗的Gas的数量,通常采用Gas Limit的数值。
1.什么是Gas Limit?

Translated into Chinese, it means fuel limit, which is the Gas maximum limit, which refers to the maximum amount of gas you are willing to pay.

When calculating the amount of Gas consumed, wallet providers such as metamask often directly give the Gas Limit. If the actual consumption is less than the Gas Limit, the remainder will be returned. If the actual consumption exceeds the Gas Limit, the transaction cannot be completed.

Assume that the amount of Gas consumed for an Ethereum network transfer is 21,000, and the Gas Limit is set to 50,000, but only 21,000 is actually consumed, then the remaining 29,000 will be automatically returned. But if the actual consumption requires 51,000, and you only set it to 50,000, then the transaction will not be completed and the 50,000 consumed will not be refunded.

Therefore, if you try to reduce the gas limit value to achieve the purpose of reducing handling fees, it may be counterproductive. Not only may the transaction be unsuccessful, but the handling fee will still be deducted.

2.How to determine Gas Limit?

The value of Gas Limit is generally automatically given by the wallet provider by default, and we usually do not need to manually modify or adjust it.

The picture below shows the Gas Limit value given by the system by default when transferring money from the MetaMask wallet.

If Gas Limit is "quantity", then Gas price is "price".

1. What is Gwei. We know that cents, jiao and yuan are the units of RMB. 1 yuan = 10 jiao = 100 cents. Gwei is the currency unit of ETH, 1Gwei=0. 0000 00001ETH, 1ETH is currently roughly equal to 1600USDT, and 1USDT is currently roughly equal to 6.8 yuan.

2. Gas price refers to the price/unit price of Gas, usually represented by Gwei. In the picture below, the current average Gas price is 9gwei.

Although Gwei is the currency unit of ETH, and the two can be converted into each other (1Gwei=0. 0000 00001ETH), when talking about Gas price, Gwei is usually used to express it, because saying "Gas price is 10Gwei" is better than "Gas price is 0.0000…1ETH “It came easily.

Some people insist on expressing it in ETH, of course there is no problem. Just like "the nail is 1 centimeter long", you have to say "the nail is 0.00000...1 kilometer long" and you can't be wrong.

3.Gas price如何确定?下面第六点展开讲。
四、什么是Gas fee
Gas fee,是在区块链上执行特定操作所需要支付的费用。可以笼统称之为“手续费”。

Since it is a fee, there is a unit of measurement. In the Ethereum network, the unit of measurement of Gas fee is usually expressed in ETH (currently 1 ETH = approximately 1600 usdt).

For example, when 10 USDT was sent to Zhang San, the handling fee was 0.01 ETH. This 0.01ETH is the gas fee paid by this transaction. Of course, it can also be represented by Gwei, just convert it using 1Gwei=0. 0000 00001ETH.

However, as you can see, 1000000Gwei has too many zeros after 1, which is not conducive to human eye reading. Therefore, people usually express it in a larger unit, ETH. For example, "the road is 100 kilometers long", usually we don't say "the road is 100...00 millimeters long".

We often hear people say, "Gas has dropped to 5Gwei now...", but they are actually saying "The unit price of Gas has dropped to 5Gwei", not the quantity of Gas (Gas Limit), nor the cost (Gas fee).

总结一下,当我们说Gas价格(Gas price)的时候,通常用gwei作单位;当我们说Gas fee 的时候,通常用ETH做单位。
五、如何计算Gas fee
上面提到Gas Limit、Gas price、Gas fee三个概念,那么Gas fee的计算就非常简单了,Gas fee=量*价,即Gas fee=Gas Limit*Gas price。

Assume that Zhang San pays 1 ETH to Li Si, the Gas Limit is 1000, the Gas price is 100Gwei, Gas fee=1000 100 =10000 0Gwei, expressed in ETH, it is 10000 0/1 0000 0000 = 0.0001ETH. Calculated based on the current US$1,600 per ETH, it is 0.00011600=0.16 US dollars.

关于Gas price,伦敦升级实施后跟以往不一样,在第六点进行说明。
六、什么是base fee、Max priority fee、max fee

When talking about Gas price above, I did not elaborate on it for better understanding. After the London upgrade is implemented on August 5, 2021, Gas price will become a fee that includes two parts: base fee and tip (Max priority fee). , in the metamask wallet, is called max fee.

1.base fee is the basic fee. Each block has a base fee that serves as a floor price. In order to be eligible to be included in a block, the gas price must be greater than or equal to the base fee. The method for determining the basic fee will not be discussed here.

2.Max priority feeMax priority fee means tip. When taking a taxi on Didi, during peak hours, if you add a tip of 10 yuan or 20 yuan, you may get a taxi first. The same principle applies to the design mechanism of Ethereum network gas fees. If you tip, you may get priority in closing the deal.

It should be noted here that the basic fee changes in real time according to network congestion. You can check the basic fee through the website, and the tip can be adjusted by yourself. Generally, it is adjusted higher rather than lower. In the figure below, base and priority represent the basic fee and tip respectively.

3.Max feeMax fee is equal to the basic fee plus tip (max priority fee + base fee). The current max fee is equivalent to the Gas price before the upgrade. When we talk about gas price, we usually refer to max fee.

4.How to determine base fee, Max priority fee and max fee? You can check online. The 19 shown in the picture below means that the average max fee during that period is 19gwei.

There are currently many websites that can be queried, and you can search by yourself.

以太坊Gas查询网址:
https://etherscan.io/gastracker;

bsc\polygon network query URL:

https://mycointool.com/GasNow?mode=eth;

含2层网络的Gas查询网址:
https://cointool.app/gasPrice/arb;

7. MetaMask instance verification

Let's take MetaMask transfer as an example to check whether the above gas fee calculation method is correct.

As can be seen in Figure 3 below,

Gas Limit:21000;

Max fee/Gas price:63.97gwei;

Then, the Gas fee is equal to the product of the two, 21000*63.974=134 3454gwei; converted into ETH, divided by 10 to the 9th power, equals 0.0013434ETH;

The calculation results are consistent with the estimation results given by the MetaMask system in Figure 1 below. Friends who are interested can go back and do the math.

8. Why is Gas needed?

If you can sum it up in one sentence, "The free ones are often the most expensive, and the paid ones are sometimes the best."

9. Why is the price of GAS sometimes so high?

Performing various operations on Ethereum, whether computing, storing data, or transferring tokens, requires paying a certain amount of Gas. Since the block space of the Ethereum network is limited, especially in times of high demand, such as snapping up virtual real estate, there is competition for limited resource space. In this case, people rush to get on the chain and complete transactions, which often leads to a sharp increase in Gas prices.

When gas prices rise, the best strategy is to temporarily avoid performing other operations. If the data you submit uses a lower Gas price, your transaction may not be confirmed. Not only does this result in the transaction not being completed successfully, but it also results in a loss of gas fees you paid.

In short, if you do not understand the use of Gas and Gas prices, you may cause unnecessary losses. Therefore, it is important to carefully check Gas prices before conducting any Ethereum transactions to reduce or avoid potential losses.

10. How to reduce GAS fee expenses

First, make sure to check current gas prices before interacting to avoid unnecessarily high fees.

Secondly, if there is no urgent need, it is recommended to choose a time period when gas prices are low to operate. Under normal circumstances, gas prices are relatively stable from the afternoon to evening, while gas prices may increase from 7 pm to the next morning. Of course, it should be noted that the gas costs of some popular projects may rise at any time.

Third, consider trying other layer 2 networks or sidechains. Now, almost all Ethereum applications can be deployed on other sidechains or second-layer networks, which often offer lower gas fees. For example, Polygon, sometimes nicknamed the "beggar chain", offers extremely low gas fees and is less expensive than Ethereum. This is a very friendly choice, especially suitable for airdrop interaction, which is in obvious contrast to the high gas price of Ethereum.

Everyone, please use your little hands to make a fortune and pay attention~