Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
tip:  174
title: CHAINID instructions in TVM
status: Final
type: Standards Track
category : VM
created: 2020-08-12

Simple Summary

To provide CHAINID instruction in TVM.


This is value can be read from smart contract to distinguish current chain with other chains.


Currently we have multiple chains in TRON ecosystem those are build from 3 main ways: testnets, side-chain and cross-chains.From smart contract perspective, currently we don't have a mechnism to distinguish those chains, which leads to potential replay attacks. As a result, a chainid parameter is required in TVM level to guanrantee smart contract safety.



CHAINID takes 0 operands pop up from stack.

The return value is the genesis block id for this chain as uint256.


CHAINID tier.ExtTier

20 Energy