How to calculate gas fees on the Filecoin network (www.blockcast.cc)

I wrote an article before and received feedback from some users. Based on the fact that some users do not understand how to use this formula, this time we will share how to calculate Gas fees step by step. From the perspective of miners, how to pay for Gas is more suitable to avoid transfer failure or late arrival.

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

1) The amount of information that remains high exceeds 1 million

The excessive amount of information is the direct cause of network congestion. The essence is that Filecoin network TPS is insufficient, and each block can only complete the packaging of a few hundred pieces of information, which indirectly affects the Block Gas Limit.

如何核算Filecoin网络上的Gas费

(Picture 1) Number of Filecoin information from November 14th to December 13th, source: IPFS Force Zone, 2020-12-15

If the Block Gas Limit of a block can only hold 100 boxes, there are 10, 20, 30, 40, 50 (Gas Limit) boxes for five miners on the market that need to be packaged and transported, because the block can only be packaged with no more than 100 boxes. Quantity. Then you can only install (10+20+30+40) or (40+50) in this block.

Then everyone will ask, can the capacity of the block be increased? It is difficult to achieve at present, mainly from the perspective of safety and economic benefits.

safety. We all know the “Mundell Impossibility Triangle”: efficiency, security and “decentralization” cannot be achieved at the same time. At the current level of technology, upgrading one of the indicators inevitably sacrifices the other two indicators. If the TPS is increased and a lot of data cannot be uploaded in time, it will gradually weaken the performance of decentralization, which will affect the consensus and security of the network while affecting decentralization.

economic profit. If the capacity of the blockchain is increased, a lot of information will be delayed in uploading, and empty blocks or orphaned blocks will easily appear, which will reduce the income of miners. Even if the block time is extended, the Filecoin network originally has a daily height of 2880, and reducing the daily block production is undoubtedly reducing the block reward. Therefore, from the perspective of economic benefits, expanding the capacity will reduce the income of miners.

From the perspective of security and economic benefits, there is currently no strategy that can directly reduce Gas, but recently the official also mentioned that the FIP-08 proposal aggregates and submits the PreCommitSector message to reduce network congestion and reduce gas consumption by merging messages; there is another improvement The TPS method without losing security is to expand the block capacity to increase the upper limit of the Block Gas Limit, while improving the performance of the miner’s hardware and continuing to invest in new hardware. This method is not very friendly to the miners.

2) Gas fee = basic burning fee (BaseToBurn) + tip (Miner Fee) + excess burning fee (OverEstimateToBurn)

As mentioned in the previous excess burning article, the protocol laboratory does not recommend the use of excessive gas fees, so some penalties will be imposed on the excess, that is, excess burning fees. Below, we use a certain Gas fee as an example to expand the calculation and explanation.

如何核算Filecoin网络上的Gas费

(Picture 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 rates respectively. BaseFee is for basic burning fee, GasPremium is for tipping rate, and GasFeeCap is for total payment rate. The official has set a parameter for tip, mainly to make GasFeeCap and the relationship between the two BaseFee + GasPremium, pay as little tip as possible.

At present, according to the news on the market, the tip is BaseFee + GasPremium ≤ GasFeeCap, that is, Miner Fee=Gas Limit*GasPremium, which is obtained by substituting the data in the above figure

如何核算Filecoin网络上的Gas费

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

Basic Burning Fee (BaseToBurn)

We all know that BaseToBurn=Base Fee*Gas Used, substituting the data in Figure 2 to calculate

如何核算Filecoin网络上的Gas费

OverEstimateToBurn (OverEstimateToBurn)

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

如何核算Filecoin网络上的Gas费

(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 finishing. Figure 3 shows that we have sorted out the Gas Limit/Gas Used from November 14th to December 14th. Most of them are in the range of 1.2-1.3, so the following formula can be used.

如何核算Filecoin网络上的Gas费

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

Take the data in Figure 2 above as an example, first obtain the Gas Limit/Gas Used=439951486/352018389=1.24979688490081, which meets the conditions in Figure 3, and substitute Over to obtain the excess combustion fee

如何核算Filecoin网络上的Gas费

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

So 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: check 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 larger than the current Base Fee . Because Gas Fee Cap is the maximum rate that users can pay, if the rate is too low, miners will be punished three times. For example, originally a transfer user needs to pay 10 yuan, but the user fills in the maximum payment of 9 yuan, but the miner neglects to complete the package, the difference of 1 yuan needs to be paid by the miner, and an additional 2 times penalty, namely 2 yuan, is required. In general, the difference will cause three times the penalty (3 yuan) to the miner. Because there are more than one million messages a day, miners may cause serious FIL penalties for ignoring this.

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

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

Therefore, when users need to transfer funds quickly, they must first ensure that the Gas Fee Cap is larger than the Base Fee and whether the Gas Premium is large enough to ensure that the transfer is executed even if it is executed.

The above suggestions are suitable for users and are for reference only for miners. Because miners need to pack a lot of information every day, more precise calculations are needed to ensure the reasonable use of gas fees. Because it is too complicated, it will not start here.

This article mainly answers some questions for users. Although the Filecoin network is too congested, miners cannot smoothly increase their computing power. However, I believe that with the optimization of the FIP proposal, the mechanism or technology will gradually solve the problem of high gas fees.

Because Filecoin’s long-cherished aspiration is to become the infrastructure of Web 3.0, the road will be long in the future. I hope all investors will wait patiently.

Comments