How To Have On-chain Messages On Filecoin Prioritized
Be it sending $FIL to other network addresses, or submitting verifications for onboarded sectors and deals, Filecoin's on-chain activities need to undergo a message-sending process that consumes scarce on-chain resources (measured in gas) to execute transactions and verifications.
The Filecoin network usually packs all messages issued within a certain period of time (usually an epoch of 30 seconds) into one block of a limited size. However, during times of spikes in message-sending, some users’ messages may experience failures due to network congestion. In order to insure themselves against these and have their messages executed in a timely fashion, message-senders can offer extra gas to “tip” block-producing storage providers to prioritize their messages. That portion of the gas is known as miner tips. In this blogpost, we will provide an overview of miner tips, as well as some suggestions on leveraging these.
Recap of Filecoin’s gas mechanism and the calculation of miner tips
Gas on Filecoin is complicated and involves many technical concepts. To make it understandable, we have created a graph (Figure 1) to illustrate how it works. On Filecoin, gas is a product of gas units and gas price per gas unit. While gas units measure how much on-chain resources are consumed, the gas price per gas unit measures message-senders’ willingness to pay for every gas unit consumed. However, since on-chain resources are limited, the network adopts a bidding mechanism to fairly allocate on-chain resources among all network participants.
As a result, message-senders will have to estimate the gas units (GasLimit) and gas price per gas unit (GasFeeCap) prior to execution. For every 30 seconds, the network will collect all estimations and calculate actual gas (BaseFee* GasUsed, under area A). The remaining gas (GasPremium*GasLimit, under area C) offered by message-senders will be sorted and prioritized from the highest to lowest amounts. Higher miner tips can therefore help message-senders quickly complete their on-chain verifications and transactions.
Figure 1: An illustration of gas on Filecoin
How miner tips on Filecoin have changed over time
Emerging blockchains such as Ethereum have previously rewarded block-producing miners with all the gas that message-senders have offered in one block as a form of reward, or tip. However, in the context of Filecoin, as the block-producing storage providers have autonomy in deciding which message can be included in the block, they might behave maliciously––such as in including their own messages at no cost––and thereby causing low usage of the block. The introduction of BaseFee aims to solve this by burning the majority of gas, while leaving small amounts of gas to incentivize block-producing storage providers to work fairly and efficiently.
Therefore, miner tips only account for a small proportion of overall gas, with daily levels usually below 100 $FIL. However, we found that from October 10, 2022 to October 15, 2022, there was a spike in miner tips due to an increase in GasFeeCap, showing message-senders have increased their willingness to pay to have their transactions executed quickly. In addition, we’ve found that October’s increase is not the result of a deliberate action by any group of users, but a spontaneous provision of miner tips by the majority of users, who have increased their miner tips from 0.00001 $FIL to >0.1 $FIL per message.
Figure 2: Daily Base Tx Fees and Miner Tips
Figure 3: An increase in GasFeeCap in Oct 2022
Figure 4: Majority of message senders have increased their miner tips in Oct 2022
Suggestions on using miner tips to prioritize your on-chain messages
Since miner tips are also associated with GasLimit, inputting higher GasLimits that exceed 10% of actual GasUsed may cause an additional Overestimation Fee. That is to say, when message-senders wish to prioritize their on-chain transactions and verifications by offering higher miner tips, they need to input higher amounts of GasFeeCap, rather than GasLimit.
However, making sensible estimates about GasLimit and GasFeeCap is not easy. In order to come close, message-senders are required to track historical changes in both parameters. The Starboard dashboard has made it easy to see how many gas units have been consumed for different messages over the past 48 hours, as well as the historical data on BaseFee changes; which will help one estimate GasFeeCap.
View relevant parameters on Starboard’s Health Dashboard
The Gas Usage section, which sits under ‘Transaction & Usage’ in Starboard’s dashboard lists the Message Count and Gas Usage information for different on-chain messages. Users can calculate the average GasUsed for different on-chain messages by dividing Gas Usage by Message Count.
Figure 5: The Gas Usage section of Starboard’s Dashboard
This will give the average GasUsed for different messages over the past 48 hours. Users can refer to this and increase <10% as GasLimit per message.
In terms of estimations on GasFeeCap, the Network Fee section under ‘Transactions & Usage’ provides information about the network’s BaseFee, which can act as a reference to estimate GasFeeCap. Through our research, we’ve found that most message senders have offered 1.01-1.05x higher than the BaseFee as their GasFeeCap (i.e. the GasPremium is usually ~0.01-0.05% of BaseFee).
Figure 6: The Network BaseFee section of Starboard’s Dashboard
While higher miner tips will help message-senders quickly complete their transactions and verifications, estimating the right amount is not easy. The most sensible strategy is to provide a GasLimit close to the actual GasUsed while benchmarking BaseFee for the estimation of GasFeeCap. Under current conditions of the network (that usually sends ~0.6 M messages per day), we found the average daily miner tips on Filecoin usually remain low at <100 $FIL. This implies most message-senders have not increased miner tips to execute their important transactions and verifications. With the arrival of the Filecoin Virtual Machine that will bring more use cases to FIlecoin, the network is expected to be busier and even gets congested once it runs at full capacity. By that time, miner tips can be helpful to quickly store, retrieve, and compute clients’ data, and improve the service quality of Filecoin!
Starboard’s dashboard continuously provides visualized tools and calculation tools to make the gas on Filecoin easily readable. Follow our Twitter at @Starboard_V to learn more about Filecoin’s gas and insights!