IMPORTANT NOTE ON TRON POWER CONSUMPTION
As all of you must be aware that NoleLegends Dapp works on the TRON Blockchain, for playing the game people need to use TRON Power which is charged by the TRON Network on any dapp/smart contract.
While all of you must already be aware of it, we thought to share a quick refresher note for the same so that you can run the DAPP smoothly.
TRX can be frozen to gain TRON Power and enable additional features. For example, with TRON Power you can vote for Super Representatives and earn rewards as well. You can gain-bandwidth or energy as well.
Frozen tokens are “locked” for a period of 3 days. During this period the frozen TRX cannot be traded. After this period you can unfreeze the TRX and trade the tokens.
Either one of bandwidth or energy can be acquired by each freeze. You cannot acquire both resources at the same time. When a user unfreezes a certain resource, his previous votes will be completely voided. If a user would like to vote using the remaining TRON Power, he will have to perform his voting operations all over again.
APPROX HOW MUCH ENERGY OR BANDWIDTH YOU EARN FOR FREEZING 1 TRX:
On an average, Smart contract execution requires approx 3 TRX or Energy in milliseconds taken by the contract (ranging from 30k to 300k depending on the TRON network). So FREEZING approx 5000+ TRX for Energy, is generally sufficient to cover energy cost of a transaction.
For Detailed understanding pls read through:
Scaling up any blockchain’s network may lead to delays on transaction confirmation, as seen in the Ethereum and Bitcoin networks. To ensure smooth network operation, the TRON network grants every account a free pool of Bandwidth Points for free transactions every 24 hours. To engage in transactions more frequently requires freezing TRX for additional bandwidth points, or paying the fee in TRX. Transactions are transmitted and stored in the network in byte arrays. Bandwidth points consumed in a transaction equals the size of its byte array. If the length of a byte array is 200 then the transaction consumes 200 bandwidth points.
Bandwidth Points Calculation
Bandwidth points are the number of usable bytes for an account per day. In any given period of time, the entire network handles a fixed amount of bandwidth. The ratio of bandwidth points in an account to the bandwidth capacity of TRON’s network equals the ratio of frozen balance in an account to frozen balance on the entire network. For example, if the frozen asset on the entire network totals 1,000,000 TRX and one given account froze 1,000 TRX (0.1% of total TRX frozen), then the account can perform roughly 300 transactions per day. Note: Since the amount of frozen asset on the entire network and for a certain account are subject to change, bandwidth points held by an account isn’t always fixed.
In a normal transaction, bandwidth points are consumed as follows:
Consume the bandwidth points the transaction initiator gained through frozen assets. If the Points are not enough, go to the next step.
Consume the transaction initiator’s free bandwidth points. If the Points are not enough, go to the next step.
Consume the transaction initiator’s TRX, calculated as the number of bytes in the transaction * 10 SUN.
The creation and operation of a smart contract consume CPU resources. It takes time for smart contracts to operate in virtual machines (VMs), and the time consumed in the system is calculated in microseconds. CPU resources are consumed in energy, which means 1 Energy = 1 Microsecond (μs). If a contract takes 100 μs to execute in a VM, it needs to consume 100 Energy. The total CPU resources provided by the TRON network are 100,000,000,000 Energy within 24 hours (based on current network parameter #20).
Energy can only be obtained by freezing the TRX. Energy obtained = the TRX frozen for gaining Energy / the total TRX frozen for gaining Energy in the entire network * 100,000,000,000, which is the equally-divided fixed Energy for all users based on the frozen TRX.
For example, suppose the total amount of TRX frozen for gaining Energy is 1,000,000,000 TRX in the current network, and one account freezes 1000 TRX, which is one-millionth of the total and equals 100,000 microseconds. If executing a contract takes 1000 microseconds, then the user can trigger the contract 100 times.
Since the total frozen funds in the network and the frozen funds of accounts may change at any time, the CPU resources owned by accounts are not fixed.
One cannot get both Bandwidth Points and Energy when freezing funds. If you freeze TRX to get bandwidth, then your Energy will not change.
The creation and execution of smart contracts consume Energy, and other normal transactions do not consume Energy. Refer to the Energy Consumption Mechanism guide for details of the consumption process.
Energy Calculator Tool
For estimating energy from freezing TRX and maximum energy limit to deploy/trigger smart contract, please use Tron Station energy tool to calculate.
Energy Model of TRX:
The maximum energy limit for deploying and triggering a smart contract is a function of several variables:
● Dynamic energy from freezing 1 TRX is 50,000,000,000 (Total Energy Limit) / (Total Energy Weight)
● Energy limit is the daily account energy limit from freezing TRX
● Remaining daily account energy from freezing TRX is calculated as Energy Limit — Energy Used
● Fee limit in TRX is set in smart contract deploy/trigger call
● Remaining usable TRX in the account
● Energy per TRX if purchased directly (10 SUN = 1 Energy) = 100,000, SRs can vote on adjustment. There are two consumption scenarios to calculate for maximum energy limit for deployment and trigger. The logic can be expressed as follows: R = Dynamic Energy Limit, F = Daily account energy from freezing TRX, E = Remaining daily account energy from freezing TRX, L = Fee limit in TRX set in deploy/trigger call. T = Remaining usable TRX in account. C = Energy per TRX if purchased directly
// Calculate M, defined as maximum energy limit for deployment/trigger of smart contract if F > L*R let M = min(E+T*C, L*R) else let M = E+T*C
You can read the TRON Whitepaper for further details: https://tron.network/static/doc/white_paper_v_2_0.pdf
Author: debasish das