When performing a transaction on any blockchain users need to pay a particular fee in order for it to be processed. This fee can be measured in different units based on the protocol and network. TRON fees are calculated using blockchain-specific metrics known as energy and bandwidth.
In this article, we will explore in detail how TRON fees work and how they are formulated.
The TRON network has two essential system resource units - energy and bandwidth. The size of the transaction bytes are measured in bandwidth and each account needs it to transfer assets on the network. Every 24 hours all active TRON addresses get 1,500 bandwidth points for free.
Energy is the other resource unit used for measuring the computation amount required by the TRON virtual machine to perform certain operations. Smart contracts fees are calculated with energy points. Unlike bandwidth, energy can only be obtained by staking TRX and there are no free daily points provided.
TRON has a daily limit for the total supply of resources that can be available on the network. For example, the total fixed supply for bandwidth is set to 43,200,000,000 per day. This means that when staking a certain amount of TRX, there is no fixed amount of points that could be generated from that, but can be calculated using a formula.
A similar rule applies to the energy unit. Based on the complexity of the smart contract, a different amount of energy can be consumed for each. Currently, the unit price of energy is 280sun. When the available energy of the account is not enough to cover the fee, TRX needs to be burned to pay for the corresponding energy. The maximum energy supply of the entire network is 90,000,000,000 per day.
As we already noted, all transaction types on TRON consume bandwidth points. Currently, the unit price of bandwidth is 1000sun. Transactions are transferred and kept on the network in byte arrays and the bandwidth points used for a transaction are equal to the size of its byte array. For example, if the byte array is 200 this means that the fee will be 200 bandwidth points. The larger the transaction, the more bandwidth resources will be consumed.
If the account doesn’t have enough bandwidth, TRX needs to be burned from the sending account to pay for bandwidth points.
Smart contracts consume energy but in order to broadcast and confirm the transaction, they also need bandwidth points.
Compared to other blockchain networks and their resource and fee models, TRON is quite friendly and this is one of the reasons why it has attracted the attention of many developers.
The TRON network follows its own rules to estimate points for consumption and order. First, it will check if the sending account’s bandwidth balance that is obtained from staking TRX is sufficient to cover the fee. If it is enough, it will consume the bandwidth obtained from staking. If it is not, it will check if the free daily bandwidth points of the initiator of the transaction are sufficient, and if so, it will use them. The other option is to burn TRX to pay for the bandwidth of the transaction according to the unit price of 0.001TRX per bandwidth.
When it comes to energy consumption, first will be consumed the points generated by staking TRX. If this energy is insufficient, TRX will be deducted from the sender’s account to pay for the resources that are required to perform the transaction. The burned TRX are calculated by the unit price of 0.00028TRX per energy.
The maximum energy cost for a transaction can be limited by setting a fee_limit parameter.
The only way to earn resources on TRON is to stake (or freeze) TRX to obtain bandwidth or energy. Users can send a FreezeBalanceContract type of transaction to stake TRX to obtain bandwidth and energy.
When doing this, it is important that the receiving address is an active one. This means that the address has or previously had TRX balance. This is a general rule for TRON in order for an address to be considered eligible for receiving resources. An account can be activated by sending any amount of TRX or TRC-10 tokens from an existing account to the new account.
We have built two TRON-specific endpoints that facilitate the obtaining of resources on the network.
Through this endpoint, customers can stake (freeze) the balance of a specific TRX address to obtain bandwidth or energy. When creating a request, the "fromAddress" is a required parameter. If a "toAddress" is not set, for such will be considered the address making the staking transaction. The account receiving the bandwidth or energy must have or previously had a TRX balance in order to be eligible to obtain the resources.. The minimum amount for staking is 1 TRX.
Note: Staking duration by default is 3 days from the time of freezing, it can NOT be more or less than that. When staking the same address again the duration resets.
With this endpoint, customers can unfreeze already staked TRX to receive resources. When unstaking bandwidth or energy, the whole amount for that resource will be released to the specified "toAddress". You can NOT specify how much to unfreeze. The request for unstaking TRX can be done 3 days after the staking transaction.