The difference in gas fees in the Filecoin network

For those who follow Filecoin frequently, they often see the word Gas, which is translated as "gas fee" in China. This article aims to explain how gas fee works and its importance to the entire Filecoin network. V| jasonbody

Filecoin is built through blockchain technology, and participants conduct transactions in a distributed network. Miners record and process messages in the blocks they mine to update the network status. Such messages include storage warehousing, storage transactions, ongoing proofs, token transactions, etc.

However, due to the constraints imposed by chain performance, scalability, and verification time, the number of messages that can be processed in a block is limited. At any given time, only a subset of messages on the network can make it a block.

In addition, the execution of messages consumes computing and storage resources on the network. Here Gas comes into play to measure the resources consumed by the message. The gas consumed by the message directly affects the cost paid by the sender to submit the message to the blockchain. And the total amount of Gas consumed by all messages in a block is limited.

Gas is regarded as the fuel of the Filecoin blockchain, just like gasoline fuel. Before starting a trip, you must pay for the gasoline consumed during the driving distance and when the engine is powered up and down. Similarly, the sender of a message on Filecoin has to pay a "gas fee" for sending a message on the Filecoin blockchain.

How Filecoin uses Gas

Gas fee was originally implemented by Ethereum and used to measure the computing and storage resources consumed by messages. This is the origin of the phrase "GasUnit". Historically, in other blockchains, miners specify GasFee in their native currency, and then pay priority fees to the blocks of production miners based on the amount of Gas consumed by the message.

Gas consumption is the cost that the entire network should bear, because each node on the network must spend storage and computing resources to verify each message and maintain a consistent state of the network. Therefore, based on the gas usage of a specific message, some gas will be burned to compensate the network. Not spreading this cost will create incentive imbalances, because miners producing blocks may include computationally expensive news for free, while others will pay for it.

BaseFee is a concept introduced by EIP1559 of Ethereum. A message’s BaseFee multiplied by Gas usage will be "burned", that is, it will be sent to an unusable address and removed from the network circulation. And it will dynamically adjust the demand for network bandwidth at a specific moment. The value will increase when the network is congested. The purpose of this design is to prevent DOS attacks and increase the cost of attacks.

In the Filecoin network, it has the same purpose. In addition to burning some fees to compensate the network, the message sender also includes a priority fee for the block of production miners, which is not bound by the amount of Gas consumed by the message. This is called GasPremium and can also be arranged outside of the agreement.

Gas usage guide

In order to help everyone better understand the Gas mechanism, the following content describes the related Gas concepts of messages and their interactions. These fields can be set by the message sender, but are currently automatic in Lotus, and more tools can be developed.

GasLimit — The limit of the amount of message execution that the message sender can consume, estimate and specify. The sum of GasLimit of all messages contained in the block must not exceed BlockGasLimit. This is in GasUnit.

GasUsage — The amount of Gas actually consumed by the execution of a message. The current protocol does not know exactly how much Gas the message will consume before execution. This is in GasUnit.

GasFeeCap — The maximum number of tokens that the sender is willing to pay for each GasUnit to include a message in the block. When sending a message, the minimum balance of the message sender must be equal to the minimum balance of GasFeeCap multiplied by GasLimit, even if not all of the balance will be consumed. Take attoFIL/GasUnit as the unit.

GasPremium — priority fee, which is paid to block production miners at the price per unit of GasLimit. This is limited by GasFeeCap, BaseFee has a higher priority. This is in attoFIL/GasUnit and can be as low as 1 attoFIL/GasUnit.

BaseFee-a network-wide variable that can be dynamically adjusted based on the sum of the GasLimit of all messages in the previous skill set. When the total GasLimit exceeds the GasLimit target of a block (signal network congestion), it will increase, and when it is lower than this value, it will decrease. Take attoFIL/GasUnit as the unit.

The message sender only needs to specify a GasFeeCap and GasLimit for each message. As the resources on the chain are consumed, GasUsage multiplied by BaseFee will be burned. Subtracting BaseFee from GasFeeCap will produce GasPremium. GasPremium multiplied by GasLimit will enter the block of production miners as a priority fee. Part of the difference between GasLimit and GasUsage will be consumed as an overestimation loss. The rest will be returned to the sender of the message.

Currently, the default implementation is for miners to select messages based on GasFeeCap/GasLimit to maximize their expected revenue given GasLimit. When the network is congested and BaseFee is high, miners can choose to box the packaging, thereby reducing the total GasLimit and reducing BaseFee, but at the expense of GasPremium.

future work

Currently, the Filecoin team is working hard to reduce message consumption on different chains to reduce Gas usage and improve network performance to increase capacity. However, there are currently some messages on Filecoin that must be included in the chain within a relatively short window, otherwise a fine will be incurred. In order to improve the economic structure and provide quality assurance for these types of messages, more work is being done. The Filecoin network is composed of customers, miners, developers, partners, and token holders, and will continue to cooperate and develop the network in a better direction.

Guess you like

Origin blog.csdn.net/weixin_49419454/article/details/109080391