Gas burning in Filecoin: a protocol-bidding mechanism to advance the network’s health
When sending messages in the blockchain, users are required to pay certain fees––known as gas––to have scarce on-chain resources computed over them. Generally, gas is charged based on a bidding mechanism, in which it goes entirely to the block-producing miner as a reward. Since each block has a limited size, only messages with the highest bids for gas can be included. This causes inefficiency in block usage as well as delays when the network is running at peak performance.
Inspired by Ethereum’s EIP1559, which introduced a market-adjusted method to regulate gas fees, Filecoin’s solution will mandate burning a portion of gas fees in every on-chain message to prevent malicious and undesired on-chain acts; as well as to enhance the primary utility of token-paying for messaging on the Filecoin network. Burning FIL tokens means part of message-senders’ payments will be permanently frozen; and this results in the deflation of token circulation. In this article, we will introduce various Filecoin burning mechanisms as well as their related consequences.
Gas is a digit unit of fuel to execute on-chain messages. As a large-scale Layer1 network, Filecoin has to face trade-offs in regulating gas usage in which message-senders seek to minimize their gas costs; while block-producing storage providers wish to maximize their gas rewards.
Rather than rewarding the block-producing storage providers with the entire gas included in the block, Filecoin has 4 different token-burning mechanisms to guarantee gas is consumed in an economically-efficient manner.
These designs are some of the deflationary forces on the circulating supply of FIL tokens. However, at present, the scheduled amount of tokens to be released is still larger than the burnt amount.
Starboard has created the Filecoin network health dashboard to better track gas usage on the Filecoin Network.
BaseFee: burning charge associated with every on-chain message
Like burning gasoline to actuate cars, gas in Filecoin, denominated in its local currency $FIL, is considered as a digital unit of fuel to empower on-chain activities. Filecoin’s gas structure is clearly defined to simply calculate gas based on the amount of gas units (GasUsed) multiplied by the price per gas unit (GasFee). Ahead of any on-chain message, message-senders do not exactly know how much computational resources are needed, and will therefore require an estimation of the quantity and price of the gas.
Traditionally, in order to incentivize block-producing SPs elected to have messages included in the block, all gas is paid to them as block rewards in a bidding mechanism. However, this design has inherent loopholes, in which block-producing SPs could absurdly consume scarce on-chain resources. For instance, since block-producing SPs are selected based on their reputations, they have the autonomy to decide which messages should be included in the block before the execution is made. However, if the selected block-producing SPs tend to behave unfairly, they can end up executing their own computationally-heavy messages at no cost. In addition, they can also collude with message-senders to drive up the bids for gas, leaving messages with low bids for gas unsuccessful. This ultimately leads to Denial-of-Service (DoS) attacks.
Therefore, Filecoin introduced a BaseFee mechanism that burns a portion of gas fees in every on-chain message. The rationale is this: given that Gas is a measure of on-chain resource consumption, it makes sense for it to be burnt like the combustion of real gasoline. Despite the fact that block-producing SPs will still include messages with the highest bids for gas in the block, they will only get part of the gas as rewards since the mandatory BaseFee will be deducted.
The BaseFee is automatically adjusted based on the network's congestion parameters (like block size) on every epoch basis. When on-chain congestion conditions vary, the base fee will adjust accordingly. In the past weeks, BaseFee has floated between 0.1-0.4 nano FIL per gas unit (as shown in Figure 1), attributing to the largest amount of burnt FIL among other burning mechanisms (as shown in figure 2).
Figure 1: Filecoin Network BaseFee changes over time
Figure 2: The number of burnt FIL among different FIL burning mechanisms
Overestimation: burning charge once message senders overbid the gas
While BaseFee is proposed by the network system to regulate block-producing SPs’ behaviors, there is a need for such policies to manage the message-sender as well. Generally, if the message sender bids with a higher gas limit plus additional tips, their messages are more likely to be executed. However, as the system-imposed BaseFee is dependent on all message-senders’ maximum willingness to pay for gas––i.e. their gaslimit––a random setting of a very high gaslimit by message-senders could result in the use of the network becoming expensive. Thus, the message sender is encouraged to stabilize the market price of gas by introducing Overestimation. This is where, in return, the system will charge more for message-senders' gas costs if they bid 10% higher than the actual gas used.
To sum up, the message sender will pay more if they overestimated the gas limit needed; and the block-producing SPs will have to take the risk of having no rewards in executing messages. But as a message-sender, how much does it cost for every message? Let’s take a look at an example.
Ahead of each message, message-senders have to input 2 variables: the quantity and price of gas they would like to pay for. To minimize cost by avoiding overestimation, the message sender should consider:
The actual gas to burn (under area A): this is a system fee that you have to pay for each message sent.
The overestimation gas to burn (under area B): this is a penalty if your estimated quantity is 10% larger than the actual quantity. A higher gas limit increases the likelihood of the message being included, but it also increases the likelihood of a high overestimation fee.
The priority fees (a.k.a. tip) (under area C): this is the extra fee to pay to have your message prioritized.
Overestimation allowance (under area D): within 10%, overestimation will not be penalized/charged.
Therefore, a message-sender pays A+B+C when sending a message in Filecoin Network. As time goes on, message-senders with better understanding of gas estimation will figure out a balance between having messages included in the block versus avoiding overestimation fees, which will become their operational advantage.
Figure 3: An illustration of gas paid by the message sender
BatchFee: burning charge once SPs batch a large amount of sectors for verification
With a unique work mechanism, Filecoin imposes sector sealing before providing storage sieves to clients. Since different states of sector sealing like ProveCommits and PreCommits need on-chain verification, SPs could either have sectors verified batched or separately. Batching sectors simply means many sectors' states can be verified on-chain at once, which has gas saving advantages over committing separately. The introduction of BatchFee is an additional fee imposed on SPs for burn if they attempt to submit a large batch of ProveCommits or PreCommits for verification. The rationale behind this design is to equalize gas costs between batch commits and single commits to avoid DoS attacks. As shown in Figure 3, it can be seen that the gas of ProveCommits and Precommits accounts for the majority gas usage, showing that the sector sealing is the primary Filecoin on-chain activity. Therefore, the network will get even more congested if other on-chain activities like sending transactions, or data retrievals, surge in the future. By introducing BatchFee, the system intends to offer an economic alternative to different sector verification methods while ensuring a smooth user experience for other on-chain activities.
Figure 4: Gas Usage by Hours in Filecoin Network
Penalty: burning charge once SPs undesirably terminate the storage services
The Filecoin Network penalizes undesired behaviors of SPs to ensure SPs are committed to providing long-term and reliable data services. Those penalties include:
Faults: if SPs’ sectors were found temporarily inactive but with notice to the network in advance, a fault fee will be applied on a daily basis, for every day the sector is faulted.
Fault discovery: if SPs’ sectors were found temporarily inactive but without notice to the network in advance, an additional charge will be applied.
Termination: when SPs decide to stop providing storage services before the agreed expiration date, the penalty will be applied depending on SPs’ acknowledgment of the penalty rules.
Effects on FIL Token Circulating Supply
Given that FIL tokens have a fixed maximum supply, burning mechanisms will act as deflationary forces to the circulating supply. From figure 5, it can be seen that the vested and minted tokens, including mining rewards, initial pledges, as well as the tokens scheduled to be released to private investors, are typically at around 0.5-0.6 million per day. On the other hand, the sum of burnt FIL ranges between 0-0.12 million per day. Therefore, compared to the amount of released tokens per day, the burning amount is still relatively small at present, which is insufficient to cause a significant decrease in circulating supply.
Figure 5: Daily change of FIL token being released over being burnt
Issues arising from gas usage have been prevailing since the arrival of blockchain commercialization. Filecoin, as a Layer 1 storage and computation infrastructure, has adopted gas-burning mechanisms to ensure the network is affordable and runs smoothly, even with an endless stream of Web3 applications being built on top of it. Rather than simply burning gas with every message sent, Filecoin also imposes penalties on SPs to regulate their working in a trusted and reliable manner.
Starboard is a Filecoin ecosystem contributor that provides network participants with easy-to-use on-chain analytics and tools. We offer visual and statistical information about how gas is consumed on the network. Please visit our Filecoin Network Health Dashboard to further explore the figures listed above and much more on-chain information. Follow us on Twitter for more updates on Filecoin!