How to reduce Filecoin gas costs

How to reduce Filecoin gas costs

The high cost of fuel (Gas) has forced old miners to stop working and take this opportunity to adjust the mining pool, but it cannot stop the influx of new miners, which continues to push up Gas costs. At this time, everyone wants to ask a question: Can Gas costs be reduced? When? How?

Many people are looking forward to every upgrade, but this is not the case. The current upgrade cannot reduce Gas consumption or Gas fees. It just makes Gas fees more reasonable.

Can gas fees be reduced? How? To make this clear, let’s take it step by step.

What is fuel (Gas)?

In the Filecoin network, Gas is a measure of the resources required to execute a message (transaction) in the network. The resources discussed here include computing resources and storage resources, that is, the cost of executing a transaction. For example, let's say that a certain PreCommitSector message consumes 25,346,170 Gas, that is, for this message, Filecoin needs to spend more than 25 million Gas to change the network state by processing this message. Each message requires the network to execute and consumes network resources, so it consumes corresponding Gas. For example, the space-time proof WindowedPoSt generally consumes 200 million to 500 million Gas; while the replication proof ProveCommitSector consumes 40 million to 60 million or more. Since general transfer messages are relatively simple to process, the Gas consumed is relatively much less, roughly within one million.

The amount of Gas consumed by each message is closely related to the message type. For example, proof messages consume a lot of Gas because they require a lot of computation and also require a lot of state information, such as Sector commits, for computation, so the consumption is high. Transfers, on the other hand, consume much less gas, both in terms of storage and computation. At the same time, the Gas consumption of the same type of message is different in different situations. This is because the network status at the time is different, and the required resource consumption is different.

For example, if two transfers are sent at the same time, the gas consumed by transferring to a new address is more than that of transferring to an old address. This is because when transferring to a new address, the network needs to create this address first, which will cost more computing and storage resources, so the consumption is higher. As a result, it is difficult for the sender of the message to determine how much gas to pay when sending a message. At this time, a reasonable estimate needs to be made.

In each message sent, the sender can set an upper limit for the Gas consumed by this message. If the Gas required for execution exceeds this upper limit, the message will not be executed. This upper limit is the message sender's estimate of the cost of this message and the maximum cost he is willing to pay. This estimate is very important, especially after supporting smart contracts. The cost estimation of some messages becomes very difficult, or bugs appear due to design reasons. The lack of an upper limit may cause huge losses to the message sender or cause network security problems.

Generally, people make an estimate of the amount of messages they send and add an insurance (such as 10-25%) to the estimate to set the upper limit: GasLimit.

How to calculate the fuel (Gas) cost?

As mentioned earlier, each message requires computing resources, which are measured by Gas. Any resource has a cost, and computing resources are no exception. The amount of Gas multiplied by a price is the cost of executing this message. The gas fee is the unit price of Gas. For example, the minimum fee for Gas defined in Filecoin is 100 attoFil, which is 0.0000000000000001 Fil. In this case, a WdPoSt message that consumes 400 million (4e8) Gas will cost:

100 attoFil * 4e8 = 40nanoFil = 0.00000004 Fil

It is very low and can be basically ignored.

However, if the unit price of Gas rises to 4 nanoFil, that is, 0.000000004 Fil, which is the average unit price of Gas in the current network, it has increased 40 million times compared to the lowest 100 attoFil. Then at this time, the same WdPoSt message that consumes 400 million (4e8) Gas will cost 1.6Fil, which is scary.

In the design of Filecoin, the EIP-1559 Gas fee mediation mechanism is introduced. The Gas fee is divided into two parts: 1) Base fee (baseFee); 2) Premium. The base fee is automatically calculated by the network, reflecting the degree of network congestion or resource consumption. This part of the fee will be burned; and the tip is the fee paid by the message sender to the miner, hoping that the miner will package his message by paying the fee.

Of course, just like GasLimit is used to set the total amount of Gas consumption; the price of Gas can also be set with an upper limit, which is feeCap. It means the highest unit price of Gas that the message sender is willing to pay.

Combining the above two parts, we conclude that the maximum fee a message sender is willing to pay for her message is:

GasLimit * feeCap

(That is, the product of the maximum amount of Gas you are willing to pay and the maximum price)

Why is Gas Fee Needed?

In a word, it is for network security. No matter what system, there is a processing capacity. For decentralized blockchain systems, because there are a large number of miners who jointly maintain the network, the general processing capacity of the network is considered. If the messages (transactions) that need to be processed exceed the processing capacity of the network, network security will be a problem. At least for Filecoin, its block generation will be affected. If a large number of messages are congested, miners with slightly lower processing capacity will be quickly eliminated from the network, and the network will be dominated by miners with the strongest processing capacity.

By adjusting the Gas fee and assisting with some penalty measures, a feedback system is formed. When the network is congested, the Gas price is increased, and when the network is idle, the price is lowered to ensure the smoothness of the network. At the same time, it can also prevent spam messages from flooding and attacks on the network. The specific approach is to set a network processing capacity value. When the total amount of Gas consumed by the message (specifically, the sum of the GasLimit) exceeds this value, the baseFee is increased, and when it is lower than this value, the baseFee is reduced. In order to adjust quickly, the adjustment method is exponential adjustment. This is why everyone sees that the Gas fee changes very quickly.

Did the two recent upgrades help adjust gas fees?

When the gas fee is high, many people hope that the Filecoin team will take measures to reduce the gas fee. There is a very simple way here, which is to artificially increase the processing power of the system. However, this cannot be done arbitrarily. If the processing power set exceeds the general processing power of the nodes in the network, on the one hand, the threshold for entering the network is increased, and on the other hand, the security of the network is reduced.

So why doesn’t the team just lower the gas fee? Is there any way to lower the gas fee?

I mentioned a reason before. For the sake of network security, we cannot set it as we want. We must consider the network situation and truly reflect the actual cost of the message. However, didn’t the last two upgrades have an impact on gas consumption? What’s going on?

Now let’s talk about these two upgrades.

The V1.2 upgrade adjusted the Gas consumption values ​​of some message processing modules. The main reason for this adjustment is that the previous version settings were relatively arbitrary, and this time it was rationalized. The specific adjustments are as follows:

What you can see directly is that the verification fee of PoSt has been greatly reduced. This has a positive impact on the consumption of WdPoSt, saving more money. However, the storage-related operation fees have increased again. This is because as the network data increases, the storage consumption cost is also increasing. The storage consumption was previously underestimated, so adjustments were made. After this adjustment, you can see that the PreCommitSector and ProveCommitSector message fees have increased instead of decreased. Especially for large miners, when the computing power is increased, the access to storage is greater, and the fuel cost of their messages is higher.

Therefore, this upgrade is not to adjust the fuel fee, or to lower the fuel fee, but to make it more reasonable.

The upgrade of V1.3 mainly solves a problem. The fuel consumption of WindowedPoSt is still too high. Especially small miners can't stand it. At the same time, this message is a control message and has to be sent. What should we do? Think of a way to burn less or not burn this part. This idea was proposed in the early discussion. Of course, there are many other ideas, but this idea is relatively simple to implement at present. Finally, it was written as FIP009 (in the previous related work section, a similar idea proposed by Steven004 was mentioned). This upgrade only adjusts the burning part of WdPoSt, but the calculation of Gas consumption has not changed.

Therefore, any idea that gas fees can be reduced through this upgrade is unrealistic.

How can we reduce the Gas fee?

In summary, we know that Gas fees involve system security issues and are related to system processing capabilities, and cannot be adjusted at will. So there are two things that can be done: 1) Improve system processing capabilities; 2) Everyone can control the rhythm of sending messages according to Gas fees, which is the rhythm of increasing computing power at present.

The most realistic and sustainable thing for Filecoin participants is that no matter how the algorithm is optimized or how the network performance is enhanced, the network will still be congested. Therefore, these situations need to be faced and handled by everyone together. This part is not something that developers can solve. The fuel fee itself is for regulation, so the rise and fall is a normal phenomenon and should be treated with a normal mind. This is the same as real economic life, which is regulated by the market.

In addition, as the Filecoin ecosystem becomes more and more prosperous, the processing power of the Filecoin network needs to be further improved, otherwise the low processing power will also hinder the development of the network and the ecosystem. This part of the work is also one of the most important tasks at present. Several proposals currently under consideration are related to the improvement of Filecoin network performance, such as:

  • FIP007: Improve the performance and security of HAMT and AMT: HAMT and AMT are the main data structures for storing state in Lotus. Improving their performance will help improve the performance of the entire network.

  • FIP008: Batch processing of pre-commitments: Currently, each sector's pre-commit is a separate message. If batch sending is supported, a lot of messages can be saved, and access and updates to storage can also be processed at one time, thus improving performance

  • Furthermore, according to the idea of ​​FIP008, Prove-Commitments can also be processed in batches. This is currently being processed in batches. However, messages are still sent individually.

  • Some more radical solutions: Considering that the largest resource consumption of message processing at present is to verify proof messages, that is, PoRep and PoSt. Then there is an idea, that is, simply do not verify. This will greatly save time. It can greatly reduce resource consumption. Then, can't you fake it without verification? Actually, it is similar to the punishment of consensus errors. Considering that the vast majority of people will not fake, consider a reporting mechanism to prevent fraud. Then, as long as there are some nodes willing to verify and report off-chain, it will be fine.

When can we see the above ideas come to fruition?

According to the current discussions of the core development team, FIP007 will be included in the next version after the New Year holiday, and the release window may be in late January; FIP008 will be implemented in the same version or put in the next version depending on the implementation situation.

There are still some issues to be discussed for radical solutions that do not require proof. For example, security issues, whether it will cause major problems if a large number of people commit fraud, how to reward whistleblowers, the deadline for reporting, etc. All of these need to be explored. This will take a longer time.

<<:  The end of year gathering at the Yuchi live broadcast room!

>>:  Some facts you should know about the sharp drop in Filecoin computing power and the sharp increase in Gas on December 20

Recommend

AntPool-Vault Data Report

AntPool Machine Gun Pool has received widespread ...

Do people with mandarin duck eyes have good luck in love?

Romantic luck is not only a kind of luck, but als...

How to know a person's personality from his face shape

As infants, our faces are like unmolded clay, wit...

A person who is always jealous of others

When seeing others living a good and happy life, ...

Will a woman with a mole on her nose become richer?

We all know that moles can grow on various parts ...

Can a woman with a pointed nose bring good luck to her husband? No luck

A woman with a pointed nose is a bad facial featu...

What is the fate of people with narrow foreheads? How to view narrow foreheads

1. People with narrow foreheads are competitive P...

Can you and him grow old together?

Can you and him grow old together? In this age of...

Can people with the Yinjiu pattern avoid villains in the workplace?

There are conflicts of interest in the workplace,...

Do people with sunken spouse palace have unhappy marriages?

An unhappy marriage is undoubtedly a tragic thing...

Find your other half from your face

In physiognomy, we can tell what kind of person t...

What does a mole on the neck mean?

Moles grow in all places, what does it mean if it...

Bitcoin - You can make money by mining with just a computer

Bitcoin is an anonymous digital currency based on...

The relationship between the position of moles on the face and destiny

In physiognomy, different moles on the face have ...

What does a very wealthy woman look like? Characteristics of Fugui

We believe that many people have heard this saying...