Differences from EVM
TVM is basically compatible with EVM with some differences in details
-
TVM uses
energyinstead ofgas. The energy price is currently 280 sun -
GASPRICE,DIFFICULTYandGASLIMITreturn zero in TVM;BASEFEEis currently not supported -
Most opcodes in TVM have the equivalent energy consumption as in the EVM, some of them are lower(e.g.,
SLOAD,CALL) -
Contract address prefix created by
CREATE2is different from EVM: TVM chooses0x41as the prefix, the formula iskeccak256( 0x41 ++ address ++ salt ++ keccak256(init_code))[12:] -
Pre-compiled contract
Ripemd160(0x03): TVM calculatesSHA-256twice on the input. There will be a new pre-compiled contract to implement the standardRipemd160 -
Pre-compiled contract
0x09: EVM hasBlake2Fon this address; on TVM it isBatchValidateSign. See TIP-43 -
There are two ways to send TRX to contracts:
TransferandTriggerSmartContractwith acallValue.Transferwill not callfallbackfunctions in the contracts
TVM has new features bases on TRON's characteristics
-
TRC-10 related opcodes:
CALLTOKEN(0xd0),TOKENBALANCE(0xd1),CALLTOKENVALUE(0xd2)andCALLTOKENID(0xd3) -
Judging whether an address belongs to a contract:
ISCONTRACT(0xd4)TIP-44 -
Batch validations for normal and multiple signatures:
BatchValidateSign(0x09)TIP-43,ValidateMultiSign(0x0a)TIP-60 -
Anonymous contract and Librustzcash related pre-compile contracts:
verifyMintProof(0x1000001),verifyMintProof(0x1000002),verifyMintProof(0x1000003)andmerkleHash(0x1000004). See TIP-135, TIP-137 and TIP-138. -
Freeze / Unfreeze functions:
FREEZE(0xd5),UNFREEZE(0xd6)andFREEZEEXPIRETIME(0xd7). See TIP-157. -
Contract voting related opcodes and pre-compiled contracts:
VOTEWITNESS(0xd8),WITHDRAWREWARD(0xd9),RewardBalance(0x1000006),IsSrCandidate(0x1000006),VoteCount(0x1000007),UsedVoteCount(0x1000008),ReceivedVoteCount(0x1000009)andTotalVoteCount(0x100000a). See TIP-271.
Compatible solutions are currently under discussion, if you are interested, please move to the GitHub ISSUE to participate in the discussion.
Updated about 4 years ago