Force Research | How to calculate gas fees on the Filecoin network

Force Research | How to calculate gas fees on the Filecoin network
This article was originally written by IPFS Force Zone

I wrote an article titled "Understanding the Current Supply and Demand Status of Filecoin Gas Fees and Excess Burning" and received some feedback from users. Since some users do not understand how to use the formula, this time we will share how to calculate the Gas fee step by step, and from the perspective of miners, how to pay Gas more appropriately to avoid transfer failures or late arrivals.

First, let’s review the current status of the Filecoin network.

1) The number of messages remains high, exceeding 1 million

Excessive amount of information is the direct cause of network congestion. Its essence is that the Filecoin network TPS is insufficient. Each block can only package a few hundred pieces of information, which indirectly affects the Block Gas Limit.

(Figure 1) Filecoin information quantity from November 14 to December 13, source: IPFS Force Zone, 2020-12-15

If the Block Gas Limit of a block can only accommodate 100 boxes, and five miners in the market have 10, 20, 30, 40, and 50 (Gas Limit) boxes to be packed and transported, because the block can only pack no more than 100 boxes, then this block can only hold (10+20+30+40) or (40+50).

So everyone will ask, can the capacity of blocks be increased? At present, it is difficult to achieve, mainly from the perspective of security and economic benefits.

Security. We all know the "Mundell Impossible Triangle Law": efficiency, security and "decentralization" cannot be achieved at the same time. At the current technical level, upgrading one of the indicators will inevitably sacrifice the other two indicators. If TPS is increased, a lot of data cannot be uploaded in time, which will gradually weaken the performance of decentralization, affecting decentralization while also affecting the consensus and security of the network.

Economic benefits. If the capacity of the blockchain is increased, it will cause a lot of information to be uploaded late, which will easily lead to empty blocks or orphan blocks, reducing miners' income. Even if the block time is extended, the Filecoin network originally has a daily height of 2880. Reducing the daily block production will undoubtedly reduce the block reward. Therefore, from the perspective of economic benefits, expanding the capacity will reduce miners' income.

From the perspective of security and economic benefits, there is currently no strategy that can directly reduce Gas. However, the official recently mentioned that the FIP-08 proposal aggregates and submits PreCommitSector messages to reduce network congestion and reduce Gas consumption by merging messages. There is also a way to increase TPS without losing security, which is to expand the block capacity, thereby increasing the Block Gas Limit, while improving the performance of miners' hardware and continuing to invest in new hardware. This method is not very friendly to miners.

2) Gas Fee = BaseToBurn + Miner Fee + OverEstimateToBurn

As mentioned in the previous article on excess burning, Protocol Labs does not recommend using excessively high gas fees, so there will be some penalties for the excess amount, which is the excess burning fee. Below, we will use a certain gas fee as an example to explain the calculation.

(Figure 2), source: filfox.info, 2020-12-14

Miner Fee

When BaseFee + GasPremium > GasFeeCap, Miner Fee=Gas Limit*(GasFeeCap-BaseFee)

When BaseFee + GasPremium ≤GasFeeCap, Miner Fee=Gas Limit*GasPremium

BaseFee, GasPremium and GasFeeCap are three types of rates, BaseFee is for the basic combustion fee, GasPremium is for the tip rate, and GasFeeCap is for the total payment rate. The official has set a parameter for the tip, mainly to make GasFeeCap pay as little tip as possible based on the relationship between the two, BaseFee + GasPremium.

According to the market information, the current tip is BaseFee + GasPremium ≤ GasFeeCap, that is, Miner Fee = Gas Limit * GasPremium. Substituting the data in the above figure, we can get

Because the Burn Fee in Figure 2 includes the basic burn fee and the excess burn fee, we need to calculate two values.

BaseToBurn

We all know that BaseToBurn = Base Fee * Gas ​​Used. Substituting the data in Figure 2, we get

OverEstimateToBurn

For excess burn fees, Filecoin sets an indicator Over for gas, mainly to avoid using too high a Gas fee, where Over=Gas Limit-11/10*Gas Used.

(Figure 3) Over indicator, source: IPFS Force Zone, 2020-12-15

According to the content of the previous article, we need to know the range of Gas Limit/Gas Used after sorting. Figure 3 shows the Gas Limit/Gas Used from November 14th to December 14th. Most of them are within the range of 1.2-1.3, so the following formula can be used.

(Figure 3) "Understanding the Current Supply and Demand Status and Excess Burning of Filecoin Gas Fees in One Article", Source: IPFS Force Zone, 2020-11-08

Taking the data in Figure 2 above as an example, we first obtain Gas Limit/Gas Used=439951486/352018389=1.24979688490081, which meets the conditions in Figure 3. Substitute it into Over to obtain the excess burn fee.

Substituting the OverEstimateToBurn and BaseToBurn obtained above, Burn Fee = OverEstimateToBurn + BaseToBurn = 0.0515588402332158 + 1.37788616484047 = 1.4294450050FIL, which is the Burn Fee in Figure 2.

Therefore, the actual total Gas fee paid is OverEstimateToBurn+BaseToBurn+Miner Fee, and the excess will be refunded.

3) How to set fees to drive miners to pack?

There are two main steps for miners to pack: checking whether the Gas Fee Cap is larger than the current Base Fee, and whether the Gas Premium is large enough.

Is the Gas Fee Cap greater than the current Base Fee ? Because the Gas Fee Cap is the maximum rate that users can pay, if the rate is too low, the miner will be punished three times. For example, a user originally needs to pay 10 yuan for a transfer, but the user filled in the maximum payment of 9 yuan, but the miner ignored the packaging and completed it, and the miner needs to pay the difference of 1 yuan, and at the same time, an additional 2 times penalty, that is, 2 yuan, so in general, the difference will cause a triple penalty (3 yuan) to the miner. Because there are more than one million pieces of information a day, miners may cause serious FIL penalties for ignoring this point.

After ensuring that the information can be packaged, miners need to weigh whether their own interests are maximized?

Is Gas Premium large enough? This mainly involves the interests of miners. The larger the Gas Premium, the more handling fees miners will receive (when BaseFee + GasPremium ≤GasFeeCap), because Miner Fee = Gas Limit * GasPremium, even if miners get the most benefits. Otherwise, as shown in Figure 2, the Gas Fee Cap is 19.57 nanoFIL, which is large, but the Gas Premium is 1 attoFIL, and the actual benefits given to miners are very small, and market behavior will delay packaging.

Therefore, when users need to transfer money quickly, they need to first ensure that the Gas Fee Cap is larger than the Base Fee and that the Gas Premium is large enough to ensure that the transfer is executed immediately.

The above suggestions are suitable for users and are for reference only for miners. Because miners need to pack more information every day, more precise calculations are required to ensure the reasonable use of gas fees. Due to the complexity, it will not be expanded here.

This article mainly answers some questions for users. Although the Filecoin network is too congested, which makes it difficult for miners to increase their computing power smoothly, the author believes that with the optimization of FIP proposals, mechanisms or technologies will gradually solve the problem of high gas fees.

Because Filecoin's long-cherished wish is to become the infrastructure of Web 3.0, the road ahead is long and arduous, and we hope that investors will wait patiently.

PS: This article only provides users with a calculation solution and does not provide investment advice.

<<:  Bitcoin mining is becoming industrialized

>>:  Four key Bitcoin price indicators show investors are buying the dip

Recommend

What will happen if the end of the marriage line is forked?

Marriage is maintained by two people, and it is d...

Are men with moles behind their ears more likely to be betrayed in friendship?

Everyone has friends. Some people can be friends ...

It is not good to have a broken lifeline on the palm

It is not good to have a broken lifeline on the p...

Cryptocurrency Mining Hardware Market to Grow at More Than 10% CAGR by 2023

According to data from Reportlinker, cryptocurren...

Fortune Line Diagram - Palmistry Analysis

The lines on our palms are all related to ourselv...

What are the facial features of a good wife?

All men in the world today hope to find a good wo...

What does a mole on the forehead mean?

What does a mole on the forehead mean? There is a...

Russian man sentenced to three years in prison for stealing friend's mining rig

According to Cointelegraph on August 30, authorit...

Judging your fortune from the length of your five fingers

In palmistry, the thumb represents parents and gr...

How to read palmistry for men

The distance between the three main lines in palm...

What does cone hand mean?

What does cone hand mean? In palmistry, one can o...

How to tell whether a man is good or bad by looking at his face

Every woman wants to marry a good man, so in phys...