Skip to main content
The Tron module decodes raw Tron transactions into VisualSign payloads. Coverage today is focused on TRX transfers and the Stake 2.0 (v2) resource staking family — the contract types that wallets sign most often outside of TRC-20 calls.

Architecture overview

Transaction model

  • Encoding: Protocol Buffers (the same protocol.Transaction and protocol.transaction.Raw messages used by tronweb and trongrid).
  • Two wire forms: parser_cli accepts both the bare transaction.Raw bytes (trongrid’s raw_data_hex) and the wrapped Transaction { raw_data, signature, ret } form that wallets sign and broadcast.
  • Account model: Account-based, similar to Ethereum, with a fixed 21-byte address format (0x41 mainnet prefix + 20-byte hash, displayed as base58check starting with T).
  • 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, and Ref Block Hash.
  • A Contract Type field plus contract-specific fields for each decoded contract.
  • Address fields rendered with the workspace AddressV2 field type (base58check T… strings), and amount fields with AmountV2 denominated in TRX.

Supported contract types

Any other contract type (TRC-10 transfers, 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 TRX instead of 30000000 SUN.
  • Addresses as base58check — Tron’s 21-byte raw addresses (0x41…) are encoded to the T… 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, or TRON_POWER. Unknown enum values surface as UNKNOWN(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:
Output:
The --network flag is accepted for parity with other chains but isn’t used today; the Tron parser has no chain-metadata plumbing.

Implementation details

Source code available at:

Resources