TRONSCAN CLASS — TRON Virtual Machine (TVM)-Part 2

TRONSCAN
3 min readJun 17, 2019

--

How TVM Works

The above flowchart shows how TVM works:
Compilation of Tron smart contract→execution and computing engines of VM→Interoperation service layer for external interfaces

Put simply, the flow is as follows:

  • Currently, TVM is compatible mainly with Solidity. The compiler translates Solidity smart contract into bytecode readable and executable on TVM.
  • A virtual machine processes data through opcode, which is equivalent to operating a logic of a stack-based finite state machine.
  • TVM accesses blockchain data and invokes External Data Interface through the Interoperation layer.

Obtaining Internal Transaction

Calling the RPC API gettransactioninfobyid with a transaction ID input parameter on an Internal Transaction supported node, returns a list of internal transactions.

The searching node config.conf should have saveInternalTx = true. Use the RPC example: in Wallet-CLI, you can use command gettransactioninfobyid <transactionId>to check all the Internal Transaction info in internal_transactions field.

Note

You may not be able to obtain the internal transaction for early transaction ID, since the node hasn’t switched on saveInternalTx = true at that time. If you wish to obtain the full data of Internal Transactions, you need a Full Node, which turns saveInternalTx = true on from the very beginning when TRON launched the TVM.

Wallet-CLI Result Example

  • Shell
InternalTransactionList: 
[
hash:
a07aaf40f35b42344d4909e8f739b32463c21a0c543fa212335f5d0d35f4db9d16
caller_address:
4145867eff384dd351003dffc38fe6e25549fac58
transferTo_address:
41537144c324033c5dc51759872f76e8f00f2edfa6
callValueInfo:
[
TokenName(Default trx):
TRX(SUN)
callValue:
10000000
]

note:
create
rejected:
false
]
[
hash:
28fbeeeab85eda244cf83172380b1f26da07ad7a34bb90abdb75dff905736ab1c
caller_address:
4143144c324033c5dc51776572f76e8f00f2edfa6
transferTo_address:
412301d22dd9c7533b3d9c006f4279a823af41456
callValueInfo:
[
TokenName(Default trx):
TRX(SUN)
callValue:
10000000
]

note:
call
rejected:
false
]

Future development of TVM

1. More developer-friendly debugging tools

Tron will be committed to the development of optimized debugging tools and the establishment of standardized symbol and data format, for improved developer efficiency.

2. Fulfillment of diversified processing demands

Different from gas consumption mechanism for every transaction on EVM, there is no charge on TVM. Each operation only occupies bandwidth, which releases within a certain amount of time after transaction completion. It takes developers very little to develop smart contracts with more complex logic. It is our belief that besides digital asset transactions use, smart contracts could also be applied to game development, financial risk modeling, scientific computing, and many more applications. The design of TVM inherently supports multi-scenario tasks, and further optimizations of processing speed, response time, and floating point compatibility.

3. Improvement of Just-In-Time (JIT) compilation speed and integration of WebAssembly

Improving JIT compilation speed is conducive to faster interpretation and optimized compilation of local code. Meanwhile, Tron is planning to further optimize its TVM based on WebAssembly (WASM). WebAssembly, spearheaded by Apple, Google, Microsoft, and Mozilla, is designed to break bottlenecks of current Web browsers and can be generated through compiling C/C++ and other programming languages. Integrating WASM, TVM will be able to provide high performance and high throughput for blockchain to cope with complex scenarios.

--

--

TRONSCAN
TRONSCAN

Written by TRONSCAN

Explore the TRON World | http://tronscan.org | Tele: https://t.me/tronscan_org #TRON #TRX $TRX #TRONSCAN

No responses yet