Architecture overview
Transaction model
- Encoding: Protocol Buffers (the same
protocol.Transactionandprotocol.transaction.Rawmessages used by tronweb and trongrid). - Two wire forms: parser_cli accepts both the bare
transaction.Rawbytes (trongrid’sraw_data_hex) and the wrappedTransaction { raw_data, signature, ret }form that wallets sign and broadcast. - Account model: Account-based, similar to Ethereum, with a fixed 21-byte address format (
0x41mainnet prefix + 20-byte hash, displayed as base58check starting withT). - Resource model: TRX is frozen to obtain Bandwidth or Energy under Stake 2.0; these resources are what funds transaction execution.
Key components
The Tron parser produces:- Top-level metadata:
Network,Timestamp,Expiration,Fee Limit,Ref Block, andRef Block Hash. - A
Contract Typefield plus contract-specific fields for each decoded contract. - Address fields rendered with the workspace
AddressV2field type (base58checkT…strings), and amount fields withAmountV2denominated in TRX.
Supported contract types
| Contract | Stake 2.0? | Fields surfaced |
|---|---|---|
TransferContract | n/a | From, To, Amount |
FreezeBalanceV2Contract | yes | Owner, Frozen Balance, Resource |
UnfreezeBalanceV2Contract | yes | Owner, Unfreeze Balance, Resource |
WithdrawExpireUnfreezeContract | yes | Owner |
DelegateResourceContract | yes | Owner, Receiver, Resource, Balance, Lock, Lock Period |
UnDelegateResourceContract | yes | Owner, Receiver, Resource, Balance |
TriggerSmartContract for TRC-20 / smart-contract calls, the deprecated Stake 1.0 family, witness/governance operations) renders as Contract Type: <type_url> (not fully decoded) — the top-level metadata is still shown, but contract-specific fields are not.
Visualization strategy
- Amounts in TRX, not SUN — amounts are converted from SUN (the on-chain integer unit) to TRX using exact integer math, so a signer sees
30 TRXinstead of30000000 SUN. - Addresses as base58check — Tron’s 21-byte raw addresses (
0x41…) are encoded to theT…form users see in wallets. Malformed inputs surface as<invalid Tron address: hex>rather than a confident-looking but synthetic string. - Resource type explicit — Stake 2.0 contracts always show whether the action affects
BANDWIDTH,ENERGY, orTRON_POWER. Unknown enum values surface asUNKNOWN(n)so a future protocol upgrade can’t silently collapse into a familiar label.
Using parser_cli
The CLI accepts the wrapped or bare hex directly:--network flag is accepted for parity with other chains but isn’t used today; the Tron parser has no chain-metadata plumbing.