So, how is the handling fee for the transfer calculated? If you go to "lettering" at the same time as the transfer, do you need to charge a higher fee? Today, Dabai will tell everyone about the Gas mechanism of Ethereum.
In the Ethereum network transfer, although the final fee we paid is ETH, but in the Ethereum does not directly consume ETH, but consumes Gas. The word "Gas" means "(gas) fuel". The operation in the Ethereum network requires the consumption of Gas, just as the car needs to consume fuel.
So how is the transaction fee (ETH) calculated? Let's take a look at a screenshot of Dabai's transfer in the Ethereum network:
In the Ethereum network transfer, the fee is calculated as follows:
Transaction Fee (ETH) = Unit Price of Gas x Number of Gas Consumption
In the big white deal, Gas's price is 5Gwei, which is 0.000000005ETH (8 decimal places after the decimal point). Here, Dabai will introduce you to the ETH unit. The smallest unit of ETH is Wei, but when it comes to Ethereum Gas, Gwei is often used. The relationship between ETH, Gwei, and Wei is as follows:
1 ETH = 10^9 Gwei (9 0) = 10^18 Wei (18 0)
Knowing the unit price of Gas, let's take a look at the amount of Gas consumed by the transfer of “White Letters”: 24876. Therefore, according to the above formula, the unit price multiplied by the quantity, you can get the fee for the big white fee:
Handling fee = 0.0000000005ETH x 24876 = 0.00012438ETH
When the car goes to the gas station to add fuel, the price of the fuel is basically fixed, but in the Ethereum network, the unit price of Gas can be set by itself. However, it should be noted that the unit price of Gas will affect the speed at which the transaction is packaged. In other words, the higher the unit price of Gas, the more miners will maximize their own interests, the more preferential the package will be.
The figure below is the unit price of Gas in the actual operation of the ethgasstation.info website and the transaction package time to wait. In the statistics chart on the left, we can see that more than 70% of the Ethereum network transfers the price of the Gas to between 4 and 20 Gwei, and the transaction with less than 1 Gwei or more than 50 Gwei accounts for a small proportion. In the chart on the right, we can see that if the given unit price of Gas is 4Gwei, the average waiting time for packaged transactions is 0.6 minutes; if it is 20Gwei, the average waiting time is 0.2 minutes.
The commonly used imToken wallet, in the unit price setting of Gas, provides 5~100Gwei, the wallet sets the lowest unit price to 5Gwei, which ensures that the transaction can be packaged in a reasonable time. Of course, if you want to cut the queue, it will be packaged by the miner as soon as possible. You can also increase the price of Gas by yourself.
After talking about the unit price of Gas, we will continue to say the amount of Gas consumed.
In the Ethereum network, every transfer, regardless of the amount, consumes a fixed amount of 21,000. If you add a note ("lettering"), you need to consume additional Gas. In the transaction back to Dabai, the total amount of Gas spent on Dabai was 24,876, which included a fixed consumption of 21,000, and the number of Gas consumed by the remarks was 3,876. Remarks How many Gases are consumed, which is related to the length of the input content. The more content, the more Gas you need to consume.
If you look closely at the screenshot of the transfer of the white, you will find that there is a bracket behind the number of Gases 24876, which is 41.46%. What does this percentage mean? If you look at the screenshots carefully, you will find that there is a Gas Limit above, the value is 60,000, and its 41.46% is exactly 24876.
Gas Limit is the upper limit of the amount of Gas consumed by this operation. You can set this upper limit yourself. For example, the setting of the white limit is 60,000, but the actual operation did not reach this upper limit, only 41.46%. The general wallet will set this upper limit by default. For our ordinary users, this upper limit is not considered when ordinary transfer. Ethereum network set this upper limit, just in case, if it encounters a malicious smart contract, the contract execution will consume unlimited fuel, which will cause the transaction party's ETH balance to be fully consumed (malicious smart contract may be Program bugs, such as contract execution, fall into an infinite loop.
Gas Limit If the setting is too low, for example, set to 10000, the amount of Gas required for any transfer is at least 21000, far exceeding the Gas Limit you set, which will cause the transfer to fail. In other words, Gas Limit will affect whether a transaction can succeed.
What questions do you have about the Ethereum transfer, or what are your experiences to share? Welcome to leave a message in the message area.
『Declaration : This series of content is only for the introduction of blockchain science, and does not constitute any investment advice or advice. If there are any errors or omissions, please leave a message. 』
Author | Yuxing produced | vernacular blockchain (ID: hellobtc)