Introduction of the new TVM instructions “freeze/unfreeze”

In order to make contract accounts have the ability to freeze TRX to obtain resources, community developers have proposed a discussion about introducing freeze/unfreeze instructions to TVM (Please refer to ). With the joint efforts from the community developers, the discussion finally formed TIP-157 and was implemented in the GreatVoyage-4.2.0(Plato) version. (The corresponding Solidity version is: Solidity 0.5.17 and Solidity 0.6.2)

The limitation of the existing resource model

In the existing TRON resource model, the freeze/unfreeze instructions of the system contract only apply to normal accounts, and contract accounts cannot freeze TRX to obtain resources. DAPP developers cannot use the TRX in the contract to obtain resources. They can only obtain resources by freezing additional TRX or burning TRX. This greatly increases the operating cost of DAPP, and the amount of freezing TRX in the entire network is also limited by this.

The goal of TIP-157 is to increase the resource utilization of contract accounts’ TRX, so that contract accounts are able to freeze TRX to obtain resources. In the TRON network, contract accounts that hold a large number of TRX can be seen everywhere. After TIP-157 is enabled, with the new instructions introduced by TIP-157, contract accounts can easily freeze their TRX to obtain resources through smart contracts. These new features will enrich the user scenarios of TRX in contract accounts.

With the joint efforts of the developer community, a vote request will be initiated on whether to enable the TVM freeze instructions in the near future(the TVM freeze/unfreeze instructions are disabled by default), and the super representative will vote to decide whether to enable it.

The new TVM instructions

TVM freeze related function introduces a total of 3 TVM instructions, the detailed instructions are as follows:

0xd5: FREEZE- Description:Freeze TRX in the contract account to obtain resources
- Parameters description:
- "receiverAddress": The address for receiving resource
- "freezeAmount": amount to freeze in SUN.
- "resourceType": 0 means bandwidth, 1 means energy
- Return value: push 1 to stack if the operation succeeds, otherwise push 0 to stack.
0xd6: UNFREEZE- Description: Unfreeze the TRX that has ended the freeze period
- Parameters description:
- "receiverAddress": The address which received resource
- "resourceType": 0 means bandwidth, 1 means energy
- Return value:push 1 to stack if the operation succeeds, otherwise push 0 to stack.
0xd7: FREEZEEXPIRETIME- Description:Query the time when the 'unfreeze' can be executed.
- Parameters description:
- "targetAddress": The address which received resource
- "resourceType": 0 means bandwidth, 1 means energy
- Return value: Return the time in seconds when the 'unfreeze' can be executed.


  • freeze and unfreeze instructions are new TVM instructions and will not affect existing contracts.
  • The TRON Nile test network has enabled TIP-157 on April 27, 2021, and supports the freeze/unfreeze instructions. For details, please refer to, all interested developers are welcome to the Nile to Experience the brand-new TVM instructions.

Contract sample code:

In TIP-157, the author provides a small piece of example code to illustrate the usage of the new instruction, the details are as follows:

contract TestFreeze {function freeze(address payable receiver, uint amount, uint res) external returns(uint) {
receiver.freeze(amount, res);
return this.getExpireTime(receiver, res) - now;

function unfreeze(address payable receiver, uint res) external returns(uint) {
return 1;

function getExpireTime(address payable target, uint res) external view returns(uint) {
return target.freezeExpireTime(res);

The difference between TVM freeze instructions and system contract freeze instructions

The new TVM freeze/unfreeze instructions make the contract accounts have the ability to freeze TRX to obtain resources, however, there are still certain differences between TVM freeze/unfreeze instructions and system contract freeze/unfreeze instruction. Here we enumerate the most frequently encountered differences among developers for your reference.

  • The TVM freeze instruction can obtain bandwidth and energy. For TRON POWER, it can be obtained and used after the TVM supports the voting instruction.
  • For the freeze instruction, the number of freezing TRX must be greater than or equal to 1 TRX = 10e6 SUN.
  • For the TVM freeze/unfreeze instructions, if receiverAddress != contractAddress , the receiverAddress must not be a contract address type.
  • When the freeze instruction is executed, if the target address is a non-existent account, it will automatically activate the target address and deduct an additional 25,000 energy as the account activation cost.

In addition, the TVM freeze instruction also brings the following new features to selfdestruct.

  • When there are freezing TRXs in the contract account and the resource receiver is the other account, executing selfdestruct will cause a REVERTexception.
  • When there are freezing TRXs in the contract account and the resource receiver is the contract account itself, executing the selfdestruct will automatically unfreeze the freezing TRX and transferred it to the target account specified in the selfdestruct instruction.

The positive impact of TIP-157

The new TVM instructions are undoubtedly very good news for DAPP developers and TRON users. Take the energy banking system as an example. At present, such systems are implemented through centralized services. After the freezing-related instructions were enabled in TVM, developers can fully implement the energy bank system through smart contracts, so that such systems can also be more decentralized, thereby reducing the security risks caused by centralized services.

According to the latest account statistics on TRONSCAN (data acquisition time is around 14:20 on May 17, 2021, Singapore time, please refer for latest statistics ), among the top 10 accounts with TRX holdings, 5 are contract accounts, and these 5 contract accounts own 70% of the total TRX of the top 10 accounts. The TVM freeze/unfreeze instruction will bring them more and more possibilities to the contract accounts that own a large amount of TRX. Developers can design more advanced and more interesting user scenarios based on these TRXs, which brings users new experiences and then enrich the entire DAPP ecosystem.

In addition, TIP-156 proposed to introduce voting instructions for TVM (currently this TIP is still in the Draft state), If the future version can integrate TIP-156, It is also possible that freezing contract accounts’ TRX to get TRON POWER, which will further enrich the application scenarios of TRX in the contract account.


This article introduces the background, usage, and potential application scenarios of the TVM freeze/unfreeze instructions. I hope readers will have a deeper understanding of TVM freeze/unfreeze instructions through this article. We will release more technical articles related to TVM in the follow-up. Please look forward to it.


For more information





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store