Energy Costs Calculation

When writing, testing and debugging smart contracts, you should be aware of the different OpCode call costs. This article provides details on the calculation of energy consumption and provides links to relevant references.

For energy costs and price calculations, see Tron Station.

OpCode Energy

The energy consumption of different OpCode is divided into different levels, with the cost level classification and corresponding energy consumption as follows:

public enum Tier {

The consumption of different OpCode can be found in

The concept of memory and storage exists in virtual machines, and the OpCode consumption for these two types of operations is calculated separately.

For example, for the memory type of OpCode, the memory size of the operation affects the consumption, for example MLOAD, MSTORE OpCode, the consumption is related to the word length of the operating memory.

For the storage type SSTORE OpCode, the consumption is not only related to the operation word length, but also need to distinguish whether the operation is reset, add, or delete.

Current value


Energy Consumption

Type of Operation

val = 0x0

sstore(val, n)
n != 0
(val = n)



val != 0x0

sstore(val, n)
n != 0
(val = n)



val != 0x0

sstore(val, 0)
(val = 0)



Other higher-consumption operations

When creating an account by transferring TRX or TRC10 from a contract to an inactive account, an additional 25000 energy is consumed and there is no account creation fee of 0.1 TRX.

When invoking other contracts with actions such as CALL, DELEGATECALL, etc., and additional transfers are made, an additional 9000 energy is consumed.

When using CREATE, CREATE2 to dynamically create a contract within a contract, it consumes 32000 energy.

When using pre-compiled contracts, different calls consume different amounts of energy, see

Energy consumption for deploying contracts

When deploying a contract, the contract code consumes 200 energy per byte.



The bytecode provided when deploying a contract is generally divided into two parts, one called the creation code and the other is the contract's runtime code. The deployment code is generally used to execute the contract constructor logic and return the actual contract runtime code. To calculate the energy consumption when deploying a contract, the length of the runtime code is used. It typically starts with the second 6060 or 6080 of the bytecode of the deployment code.