TRON Developer Hub

The TRON Developer Hub

Welcome to the TRON developer hub. You'll find comprehensive guides and documentation to help you start working with TRON as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Introduction

The creation and operation of a smart contract consumes 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 1Energy == 1 microsecond. If a contract takes 100 microseconds to execute in a VM, it needs to consume 100 Energy. The total CPU resources provided by the TRON network are 50,000,000,000 Energy within 24 hours.

Gaining Energy

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 * 50_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 1000_000_000 TRX in the current network, and one account freezes 1000 TRX, which is one millionth of the total and equals 32400 microseconds. If executing a contract takes 324 microseconds, then the user can trigger the contract 100 times.

Note

  • 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.

Energy Consumption

The creation and execution of smart contracts consume Energy, and other normal transactions do not consume Energy.

Energy Calculation Methods

Energy is consumed as follows:

  1. Try to consume the Energy that the transaction initiator gained through frozen assets. If it is not enough, then deduct and return the rest. If it is not enough, then deduct whatever it has and go to the next step.

  2. Try to consume the TRX of the transaction initiator, the number of TRX = Energy needed * 100 sun.