Quick Access
Coin Methods
Tron
Miscellaneous
Methods
Tron
tronSignTransaction

Tron: sign transaction

Sign a given Tron transaction on device. User will be asked to confirm transaction details on Trezor. The API is compatible with TronWeb transaction object.

Currently supported contract types:

  • TransferContract
  • TriggerSmartContract
  • FreezeBalanceV2Contract
  • UnfreezeBalanceV2Contract
  • WithdrawExpireUnfreezeContract
const result = await TrezorConnect.tronSignTransaction(params);

Params

Including CommonParams

TronSignTransaction

ref_block_bytes

String

Required

last 4 bytes of the reference block height, in hex format

ref_block_hash

String

Required

8th to 16th(exclusive) bytes of the reference block hash(ID), in hex format

expiration

Number

Required

expiration time of the transaction which should be no more than 1 day. The unit is milliseconds

timestamp

Number

Required

timestamp of the transaction. The unit is milliseconds

fee_limit

Number

Optional

maximum fee to consume in a contract related transaction. The unit is sun (1 TRX = 1000000 sun)

data

String

Optional

optional transaction memo

Example

Use TransferContract to send a TRX transfer

const { signature } = await TrezorConnect.tronSignTransaction({
    path: "m/44'/195'/0'/0/0",
    ref_block_bytes: 'e942',
    ref_block_hash: '6394747da9fee421',
    expiration: 1752562632000,
    timestamp: 1752562572000,
    fee_limit: 10000000,
    contract: [
        {
            type: 'TransferContract',
            parameter: {
                value: {
                    owner_address: '41f2cd810c48c401d392ead3c6e1e1cb9f57750a58',
                    to_address: '4141f82674a30ae1328745d08afe2d1a0a24195283',
                    amount: 18123456,
                },
            },
        },
    ],
});

Use TronWeb to create the transaction object

const transaction = await tronWeb.transactionBuilder.sendTrx(
    'TVDGpn4hCSzJ5nkHPLetk8KQBtwaTppnkr',
    100,
    'TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL',
);
const result = await TrezorConnect.tronSignTransaction({
    path: "m/44'/195'/0'/0/0",
    ...transaction.raw_data,
});
const sent = await tronWeb.trx.sendRawTransaction({
    ...transaction.raw_data,
    signature: [result.payload.signature],
});

Result

{
    success: true,
    payload: {
        signature: string, // signed transaction in hex format
    }
}

Error

{
    success: false,
    payload: {
        error: string // error message
    }
}