The operation mode and significance of gas fees in the Filecoin network

The operation mode and significance of gas fees in the Filecoin network
Professionalism and focus, win-win cooperation

This is the latest in our series highlighting the unique features of the Filecoin network. This post dives into how gas fees work and why they are important to the Filecoin network.


Filecoin is a blockchain economy where participants conduct transactions on a distributed network. The network state is updated by nodes recording and processing messages in the blocks they mine. There are multiple messages, including storage deposits, storage transactions, proofs in progress, token transactions, etc.

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

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

Gas is considered the “fuel” of the Filecoin blockchain, just like fuel for your car. Before you can go on a road trip, you have to pay for the gas consumed in driving the distance and powering the engine up and down hills. Similarly, message senders on Filecoin pay for the gas that “drives” the execution of messages on the Filecoin blockchain.

How Filecoin uses gas fees

Gas was first implemented on the Ethereum blockchain to measure the computational and storage resources consumed by a message. This is the origin of the phrase "GasUnit". Historically, in other blockchains, test nodes specify GasFee on their own devices and then pay priority fees to the blocks of production nodes based on the total amount of message consumption.

However, gas consumption is a cost that should be borne by the entire network, because every node on the network must expend storage and computing resources to verify each message and maintain a consistent state of the network.

This way, some gas is consumed to compensate the network based on the gas usage of a particular message. Not spreading this cost creates incentive misalignment, as block-producing nodes may include computationally expensive messages for free while others pay for them.

BaseFee is a concept introduced by Ethereum's EIP1559. A message is "consumed" by its BaseFee multiplied by Gas usage. Burning means sending it to an address where it cannot be spent and is removed from circulation on the network. It is dynamically adjusted based on the demand for network bandwidth at a given moment. When the network becomes congested, it rises, so that message senders with a valuation lower than the network's BaseFee will hold on and wait until the congestion is cleared.

The rate of change of BaseFee is designed to increase the potential DOS attack quickly and decrease quickly as the network becomes less busy. Message senders who cause the network to become more congested will also internalize the cost by paying higher fees. Consumption also creates slow deflationary pressure that benefits all network participants.

Going back to our road trip analogy, think about the burning of gas in your car, and the network in normal traffic. If the road is congested (like during rush hour), and traffic is stop-and-go, your car will use more gas. In this case, it might make sense to wait a little longer before starting your trip. The same theory applies to the Filecoin network - when network traffic is congested, gas will be high, so it might make sense to wait and try again later.

In addition to consuming some fees to compensate the network, the message sender also includes a priority fee for the block produced by the node, which is not bound by the amount of gas consumed by the message. This is called GasPremium and can also be arranged outside the protocol.

A Practical Guide to Gas Fees

To help readers better understand the Gas mechanism, the following describes the relevant concepts 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 on the amount of message execution that a message sender can consume, estimated and specified. The sum of the GasLimits of all messages included in a block must not exceed the BlockGasLimit. This is in GasUnits.


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

  • GasFeeCap : The maximum number of tokens the sender is willing to pay per GasUnit for the inclusion of a message in a block. When sending a message, the sender of the message must have a minimum balance equal to GasFeeCap multiplied by GasLimit, even if not all of the balance will be consumed. Measured in attoFIL/GasUnit.



  • GasPremium: Priority fee, which is paid to block producing nodes at a price per unit of GasLimit. This is subject to the GasFeeCap, with BaseFee having a higher priority. This is in attoFIL/GasUnit and can be as low as 1 attoFIL/GasUnit.



  • BaseFee : A network-wide variable that dynamically adjusts based on the sum of the GasLimits of all messages in the previous tip set. It will increase when the total GasLimit exceeds the GasLimit target for a block (signaling network congestion), and decrease when it falls below that value. Measured 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 consumed. Subtracting BaseFee from GasFeeCap will produce GasPremium. GasPremium multiplied by GasLimit will enter the block of the production node 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 the on-chain node selects messages based on GasFeeCap/GasLimit to maximize its expected benefit given the GasLimit. When the network is congested and the BaseFee is high, the node may choose to box the package, thereby reducing the total GasLimit to reduce the BaseFee, but may be at the expense of GasPremium.

Future Work

The Filecoin research and engineering team is working to reduce the resource consumption of different on-chain messages to reduce Gas usage and improve network performance to increase capacity. However, there are currently some messages on Filecoin (such as SubmitWindowedPoSt) that must be included in the chain within a relatively short window, otherwise a penalty will be incurred.

More work is being done to improve the economic structure and provide quality of service guarantees for these types of messages. The Filecoin network, consisting of clients, on-chain nodes, developers, partners, and token holders, will continue to collaborate and evolve the network to a better direction.

Please follow the Filecoin Lotus documentation and the Filecoin Improvement Protocol for future improvements.


<<:  The real reason behind Bitcoin’s sudden rise

>>:  Filecoin may combine with DeFi to create new features. This article provides an overview of the decentralized storage track

Recommend

What is the fate of people with ape eyes?

Monkey eyes are round, small and slightly yellow,...

Different facial features

Different facial features In today's society,...

Blockchain for record keeping? UK government tries it out

The UK government is exploring the use of blockch...

Interpretation of the fork in the wealth line, which situation do you belong to?

The wealth line is a very important line in palmis...

BCC, which was born on August 1, is not a fork of the Bitcoin network

Bitcoin has successfully activated the SW2X ( Seg...

Destiny from the back

In physiognomy, body shape, face shape and palm s...

What kind of woman is the most attractive?

Some people's attractiveness is limited to th...

Focusing on the development of digital economy, Huobi Club opens Yiwu node

On July 28, the 2019 Global Digital Economy Summi...

Palmistry tells how to make a fortune in this life

Palmistry tells how to make a fortune in this lif...

Bitcoin price hits $260

The price of Bitcoin has continued to rise, reach...

Blockchain: Infinite Possibilities in the Future

You may have heard of Bitcoin, or perhaps a netwo...

Teach you to read your fortune from your palm to see if you are rich

1. There are money lines on the hands The small s...