Committee Proposal 85

TRON Core Devs
TRON
Published in
2 min readMay 19, 2023

Committee proposal 85 is a voting request for modifying the №71 parameter, optimizing the return value of the chainid opcode in TVM, please refer to here for the origin discussion. The №85 committee proposal is already in effect, please refer to here for the voting details, this post is dedicated to provide more details.

Why need to optimize?

Previously, the return value of the chainid instruction in the smart contract on TRON is the hash of the genesis block, which may cause two main problems,

  1. The return value of TVM chainid is inconsistent with the return value of the JSON-RPC interface eth_chainid of the TRON java-tron node. TVM chainid returns the complete hash value of the genesis block and the eth_chainid API returns the last four bytes hash value of the genesis block.
  2. The value represented by the hash of the genesis block is too large, exceeding the maximum integer value of the Javascript commonly used in web3.

These problems are inconvenient to developers, therefore, optimization of the return value of chainid instruction in TVM is necessary.

Introduction of optimized return value of the chainid opcode in TVM

Now, the return value of the chainid instruction in TVM becomes the last four bytes of the genesis block hash, as follows,

The return value of chainid instruction in TVM on different chains

The optimized return value is now consistent with the return value of eth_chainid of the JSON-RPC interface of Java-tron.

How to adapt?

For certain contracts that involve TVM chainid instructions, it is recommended to prepare the corresponding adaption work, for more detailed information, please refer to here.

Summary

After the proposal to optimize the return value of the TVM chainid instruction takes effect, it will improve the availability of the off-chain signatures used on the chain and help reduce the complexity of development work.

--

--