Filecoin Mini Class: Why is Gas Fee so Important?

Filecoin Mini Class: Why is Gas Fee so Important?


This is the latest in our series highlighting the unique features of the Filecoin network. This post takes a deep dive into gas fees — how they work, and why they’re important to the Filecoin network.

Filecoin supports the blockchain economic model, where participants conduct transactions on a distributed network. The network status is updated by miners recording and processing messages in blocks. There are multiple messages, including storage loading, storage transactions, continuous proofs, token transactions, etc.

However, the number of messages that can be processed in a block is limited by chain performance, scalability, and verification time. Therefore, only a portion of the messages on the network can successfully be included in a block at any given time.

In addition, executing messages consumes computational and storage resources on the network. This is where "Gas" comes into play, which measures the resources consumed by information. The Gas consumed by an on-chain message directly affects the cost paid by the sender to submit the message to the blockchain. And the total GasFee usage of all messages in a block is limited.

"Gas" can be thought of as the fuel of the Filecoin blockchain, just like the fuel of a car. Before you start your road trip, you have to pay for the distance you travel and the gasoline you consume to power the engine going up and down the hill. Similarly, message senders on the Filecoin blockchain also need to pay GasFee.

How Filecoin officially uses GAS

The concept of "Gas" was first introduced on the Ethereum blockchain as a measure of the computational and storage resources consumed by a message. This is the origin of the phrase "GasUnit". Historically, in other blockchains, miners specify a GasFee in units of a native currency, and then pay priority fees to miners who generate blocks based on the "Gas" consumed by the message .

However, "Gas" consumption is a cost that the entire network should bear, because each node on the network has to spend storage and computing resources to verify each message and keep the network in a consistent state. Therefore, according to the "Gas" usage of a specific message, a certain amount of "Gas" is consumed to compensate the network. Not distributing this cost will create incentive misalignment, because miners may include a message that is actually expensive to calculate for free when they produce a block, because the cost of the message is innocently borne by others.

BaseFee is a concept introduced by Ethereum EIP1559. The Base fee multiplied by the Gas usage of the message is the "burn amount". Burning means that it is sent to an unusable address and removes loops on the network. It is dynamically adjusted based on the demand for network bandwidth at a given moment . As the network becomes congested, it will rise, so messages from senders with a valuation lower than the network's Base fee will remain waiting until the state of message congestion improves. The rate of change in BaseFee is designed to increase quickly to guard against potential DOS attacks, and decrease quickly as the network becomes idle. Message senders who cause the network to become more congested will also internalize the cost by paying higher fees. Fee burning also creates slow deflationary pressure that benefits all network participants.

Going back to our travel analogy, think about how gasoline is used in normal traffic. If the roads are congested, such as during rush hour, and traffic is not smooth, your car will consume more gasoline. In these cases, it may make sense to wait for a while before starting a trip. The same theory applies to the Filecoin network - when network traffic is congested, GasFee will be high, and it may be a wiser choice to wait and try again later.

In addition to burning fees to compensate the network, the message sender also includes a priority fee to the miner, which is independent of the GasFee consumed by the message. This is called GasPremium and can also be outside the protocol.

GAS Practical Guide

To help readers better understand the GasFee mechanism, the following is a list of relevant Gas concepts for messages and their interactions. These fields can be set by the message sender, but are currently automated in Lotus and more tools can be developed.

GasLimit - The amount of Gas that can be consumed, estimated and limited by the message sender during the message execution. The sum of GasLimits of all messages included in a block must not exceed the block Gas Limit. Here it is in GasUnit.

GasUsage – The amount of Gas actually consumed by the execution of the message. The current protocol does not know how much Gas a message will consume before it is executed. Here it is in GasUnit.

GasFeeCap – The maximum number of tokens (FIL) that the sender is willing to pay per GasUnit for including a message in a block. When sending a message, the sender must have a minimum balance of GasFeeCap multiplied by GasLimit, even if not all of the balance will be used. Here the unit is attoFIL/GasUnit.

GasPremium – An additional priority fee paid to miners per GasLimit. This is capped by GasFeeCap and BaseFee with higher priority. It is in attoFIL/GasUnit and can be as low as 1 attoFIL/GasUnit.

BaseFee – A network-wide variable that is dynamically adjusted based on the sum of the GasLimit of all messages in the previous TipSet. It will increase when the total GasLimit exceeds the GasLimit target of the block (network congestion), and it will decrease when it is below this value. It is expressed in attoFIL/GasUnit.

The message sender only needs to specify a GasFeeCap and GasLimit for each message. As on-chain resources 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 the producing miner 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 message sender.

Currently, the default implementation is that miners select messages based on GasFeeCap/GasLimit to maximize their expected revenue given the GasLimit. When the network is congested and the BaseFee is high, miners can choose to package blocks to reduce the total GasLimit to reduce the BaseFee, but may be at the expense of GasPremium.

Future Work

The research and engineering teams are working to reduce the resource consumption of various on-chain messages to reduce gas usage and improve network performance to increase blockchain capacity. However, there are currently some messages on Filecoin (such as WindowedPoSt) that must be submitted to the chain within a relatively short time window, otherwise penalties will be incurred. In order to improve the economic structure and provide quality of service guarantees for these types of messages, we are doing more work. The Filecoin network is composed of clients, miners, developers, partners, and token holders, and will continue to work together and develop the network to a better direction. Please follow the Filecoin Lotus document and the Filecoin Improvement Agreement for future improvements.


<<:  【Filecoin Weekly Report-69】Filecoin important version update, mainnet is getting closer!

>>:  Valuable datasets stored via Filecoin Slingshot

Recommend

Face analysis: Which kind of women should not be married?

There are more and more single men nowadays, and ...

Mole shape of a good man who can make his wife prosperous

Mole shape of a good man who can make his wife pr...

Bitcoin falls below $60,000, long position liquidation hits a one-month high

Bitcoin fell below $60,000 as traders closed thei...

Facial features that indicate elegant behavior in daily life

Some people appear to be more casual in real life...

Is it true that women with high cheekbones are not good for their husbands?

Is it true that women with high cheekbones are no...

How to eliminate nasolabial lines

The nasolabial folds are the skin folds on both s...

Why Are North Korean Hackers So Good at Stealing Cryptocurrency?

Ben Zhou, the boss of Dubai-based cryptocurrency ...

Coinbase BTC balance drops to lowest level since December 2017

On-chain analysis company Glassnode tweeted that ...

How to choose between big mining coins and small mining coins?

host First, please give a brief introduction. Li ...