Ether transfer, how to calculate the fee and how to save money?

How is the transfer fee calculated? If you transfer money and “engrave” at the same time, do you need to charge a higher fee?

When transferring ETH or ERC-20 Token through a wallet, we know that there is a fee for the transfer. In addition, as described in the article “Zhao Liying’s wedding news is already on the chain, you can teach yourself how to create a blockchain “diamond ring””, we can also transfer money while “engraving” on the blockchain.

So, how is the transfer fee calculated? If you transfer money and also “engrave”, do you need to charge a higher fee? Today, Da Bai will talk about the Gas mechanism of Ether.

In the Ethernet network, although the final fee we pay is ETH, but in fact, it does not consume ETH directly inside the Ethernet, but consumes Gas. The operation in the Ethernet network needs to consume Gas, just like a car needs to consume fuel to run.

So, how is the transaction fee (ETH) calculated? Let’s take a look at a screenshot of a transfer in the ethereum network.

Ether transfer, how to calculate the fee and how to save money?

To transfer funds in the Ethernet network, the processing fee is calculated as follows.

Transaction fee (ETH) = Unit price of Gas x Amount of Gas consumed

In this transaction, the unit price of Gas is 5Gwei, which is 0.0000000005ETH (8 zeros after the decimal point). The relationship between ETH, Gwei and Wei is as follows.

1 ETH = 10^9 Gwei (9 zeros) = 10^18 Wei (18 zeros)

Now that we know the unit price of Gas, let’s look at the amount of Gas consumed by this transfer with “engraving”: 24,876. So, according to the above formula, multiplying the unit price by the quantity, we can get the fee spent by Da Bai

Handling fee = 0.0000000005ETH x 24876 = 0.00012438ETH

When a car goes to a gas station to add fuel, the price of fuel is basically fixed, but in the Ethernet network, the unit price of Gas can be set by yourself. However, it is important to note that the unit price of Gas affects the speed at which this transaction is packaged. That is to say, the higher the unit price of Gas you give, the more miners will pack your transactions first in order to maximize their own interests.

The graph below shows the unit price of Gas in practice and the waiting time for a transaction to be packaged according to the ethgasstation.info website. In the left chart, we can see that more than 70% of ethereum network transfers give a unit price of Gas between 4 and 20 Gwei, with very few transactions less than 1 Gwei or more than 50 Gwei. In the right chart, we can see that the average waiting time for a packaged transaction is 0.6 minutes if the unit price of Gas is 4Gwei, and 0.2 minutes if it is 20Gwei.

Ether transfer, how to calculate the fee and how to save money?

The imToken wallet, which is commonly used by everyone, offers 5 to 100 Gwei in the unit price setting for Gas. The wallet sets the minimum unit price at 5 Gwei to ensure that transactions are packaged in a reasonable amount of time, but of course, if you want to jump the queue and be packaged by miners as soon as possible, you can also raise the unit price of Gas yourself.

After talking about the unit price of Gas, let’s move on to the amount of Gas consumed.

In the Ethernet network, each transfer, regardless of the amount, consumes a fixed amount of Gas, 21000, and if you add a note (“inscription”), you need to consume additional Gas. The amount of Gas consumed for a note depends on the length of the input, the more content, the more Gas is consumed.

If you look closely at the screenshot of the transfer, you will see that there is a bracket after the amount of Gas spent by White, which is 41.46%. What does this percentage mean? If you look more closely at the screenshot, you will see that there is also a Gas Limit on it with a value of 60,000, and it is 41.46% of exactly 24876.

Gas Limit is the upper limit of the amount of Gas consumed by this operation, and you can set this upper limit yourself. For example, the value set by Dabai is 60,000, but the actual operation did not reach this limit, only 41.46% was used.

The general wallets will set this upper limit for you by default, and for us ordinary users, we don’t need to consider this upper limit for ordinary transfers. This limit is set by the ethereum network in case of a malicious smart contract, which will consume unlimited fuel, which will lead to the total consumption of the ETH balance of the counterparty (a malicious smart contract may be a program bug, such as the execution of the contract is stuck in a dead loop).

If the Gas Limit is set too low, for example to 10,000, any transfer that requires at least 21,000 Gas, far more than the Gas Limit you set, will cause the transfer to fail. In other words, the Gas Limit affects whether a transaction will succeed or not.

Posted by:CoinYuppie,Reprinted with attribution to:https://coinyuppie.com/ether-transfer-how-to-calculate-the-fee-and-how-to-save-money/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Like (0)
Donate Buy me a coffee Buy me a coffee
Previous 2021-05-26 07:30
Next 2021-05-26 07:39

Related articles