Energy Costs Table

In the course of writing, testing, and debugging your smart contract, it is advisable to be mindful of the opcode call costs. Below is a table with call Energy usage estimates, cost classification tier, operation notes, and energy calculation notes. If you wish to estimate energy costs for deploying or triggering smart contract, please refer to Tron Station which has an energy tool can help you.

For the Cost Tier, the classification is as follows:

  • ZeroTier: 0 sun expended
  • BaseTier: Approximately 2 sun expenditure
  • VeryLowTier: Approximately 3 sun expenditure
  • MidTier: Approximately 8 sun expenditure
  • HighTier: Approximately 10 sun expenditure
  • ExtTier: Approximately 20 sun expenditure
  • SpecialTier: Custom amount of energy expenditure. Can be very high.
CodeMnemonicEnergy Used - (sun)Cost TierOperation NotesEnergy Calculation Notes
0x00STOP0ZeroTierHalts execution
0x01ADD3VeryLowTierAddition operation
0x02MUL5LowTierMultiplication operation
0x03SUB3VeryLowTierSubtraction operation
0x04DIV5LowTierInteger division operation
0x05SDIV5LowTierSigned integer division operation (truncated)
0x06MOD5LowTierModulo remainder operation
0x07SMOD5LowTierSigned modulo remainder operation
0x08ADDMOD8MidTierModulo addition operation
0x09MULMOD8MidTierModulo multiplication operation
0x0aEXP(exp == 0) ? 10 : (10 + 10 * (1 + log256(exp)))SpecialTierExponential operationIf exponent is 0, gas used is 10. If exponent is greater than 0, gas used is 10 plus 10 times a factor related to how large the log of the exponent is.
0x0bSIGNEXTEND5LowTierExtend length of two’s complement signed integer
0x10LT3VeryLowTierLess-than comparison
0x11GT3VeryLowTierGreater-than comparison
0x12SLT3VeryLowTierSigned less-than comparison
0x13SGT3VeryLowTierSigned greater-than comparison
0x14EQ3VeryLowTierEquality comparison
0x15ISZERO3VeryLowTierSimple not operator
0x16ANDVeryLowTierBitwise AND operation
0x17OR3VeryLowTierBitwise OR operation
0x18XOR3VeryLowTierBitwise XOR operation
0x19NOT3VeryLowTierBitwise NOT operation
0x1aBYTE3VeryLowTierRetrieve single byte from word
0x20SHA330 + 6 * (size of input in words)SpecialTierCompute Keccak-256 hash30 is the paid for the operation plus 6 paid for each word (rounded up) for the input data.
0x30ADDRESS2BaseTierGet address of currently executing account
0x31BALANCE20ExtTierGet balance of the given account
0x32ORIGIN2BaseTierGet execution origination address
0x33CALLER2BaseTierGet caller address
0x34CALLVALUE2BaseTierGet deposited value by the instruction/transaction responsible for this execution
0x35CALLDATALOAD3VeryLowTierGet input data of current environment
0x36CALLDATASIZE2BaseTierGet size of input data in current environment
0x37CALLDATACOPY`2 + 3 * (number of words copied, rounded up)VeryLowTierCopy input data in current environment to memory2 is paid for the operation plus 3 for each word copied (rounded up).
0x38CODESIZE2BaseTierGet size of code running in current environment
0x39CODECOPY2 + 3 * (number of words copied, rounded up)VeryLowTierCopy code running in current environment to memory2 is paid for the operation plus 3 for each word copied (rounded up).
0x3aGASPRICE2BaseTierGet price of gas in current environment
0x3bEXTCODESIZE20ExtTierGet size of an account’s code
0x3cEXTCODECOPY20 + 3 * (number of words copied, rounded up)ExtTierCopy an account’s code to memory20 is paid for the operation plus 3 for each word copied (rounded up).
0x3dRETURNDATASIZE2BaseTier
0x3eRETURNDATACOPY3VeryLowTier
0x40BLOCKHASH20ExtTierGet the hash of one of the 256 most recent complete blocks.
0x41COINBASE2BaseTierGet the block’s beneficiary address
0x42TIMESTAMP2BaseTierGet the block’s timestamp
0x43NUMBER2BaseTierGet the block’s number
0x44DIFFICULTY2BaseTierGet the block’s difficulty
0x45GASLIMIT2BaseTierGet the block’s gas limit
0x50POP2BaseTierRemove item from stack
0x51MLOAD3VeryLowTierLoad word from memory
0x52MSTORE3VeryLowTierSave word to memory
0x53MSTORE83VeryLowTierSave byte to memory
0x54SLOAD50SpecialTierLoad word from storage
0x55SSTORE((value != 0) && (storage_location == 0)) ? 20000 : 5000SpecialTierSave word to storage20000 is paid when storage value is set to non-zero from zero. 5000 is paid when the storage value's zeroness remains unchanged or is set to zero.
0x56JUMP8MidTierAlter the program counter
0x57JUMPI10HighTierConditionally alter the program counter
0x58PC2BaseTierGet the value of the program counter prior to the increment corresponding to this instruction
0x59MSIZE2BaseTierGet the size of active memory in bytes
0x5aGAS2BaseTierGet the amount of available gas, including the corresponding reduction for the cost of this instruction
0x5bJUMPDEST1SpecialTierMark a valid destination for jumps
0x60 -- 0x7fPUSH1*3VeryLowTierPlace byte item on stack. 0 < <= 32
0x80 -- 0x8fDUP1*3VeryLowTierDuplicate th stack item. 0 < <= 16
0x90 -- 0x9fSWAP*3VeryLowTierExchange 1st and ( + 1)th stack items. 0 < <= 16
0xa0LOG0375 + 8 * (number of bytes in log data)SpecialTierAppend log record with no topics.375 is paid for operation plus 8 for each byte in data to be logged.
0xa1LOG1375 + 8 * (number of bytes in log data)SpecialTierAppend log record with one topic.375 is paid for operation plus 8 for each byte in data to be logged plus 375 for the 1 topic to be logged.
0xa2LOG2375 + 8 * (number of bytes in log data)SpecialTierAppend log record with two topics.375 is paid for operation plus 8 for each byte in data to be logged plus 2 * 375 for the 2 topics to be logged.
0xa3LOG3375 + 8 * (number of bytes in log data)SpecialTierAppend log record with three topics.375 is paid for operation plus 8 for each byte in data to be logged plus 3 * 375 for the 3 topics to be logged.
0xa4LOG4375 + 8 * (number of bytes in log data)SpecialTierAppend log record with four topics.375 is paid for operation plus 8 for each byte in data to be logged plus 4 * 375 for the 4 topics to be logged.
0xf0CREATE32000SpecialTierCreate a new account with associated code.
0xf1CALL40SpecialTierMessage-call into an account.
0xf2CALLCODE40SpecialTierMessage-call into this account with an alternative account’s code.
0xf3RETURN0ZeroTierHalt execution returning output data.
0xf4DELEGATECALL40SpecialTierMessage-call into this account with an alternative account’s code, but persisting the current values for sender and value.
0xfaSTATICCALL40SpecialTierOpcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present). Any opcode that attempts to perform such a modification (see below for details) will result in an exception instead of performing the modification.
0xfdREVERT0ZeroTierThe REVERT instruction will stop execution, roll back all state changes done so far and provide a pointer to a memory section, which can be interpreted as an error code or message. While doing so, it will not consume all the remaining gas.
0xffSUICIDE0ZeroTierHalt execution and register account for later deletion

You can also check the spreadsheet on Google Doc.