Send TRX and Transactions
Send native TRX, smart-contract calls, and pre-built TronWeb transactions on Tron.
This guide explains how to send native TRX, send smart-contract calls, send pre-built TronWeb transactions, estimate transaction fees, cap transaction fees, sign without broadcasting, and use dynamic fee rates.
On Tron, values are expressed in sun (1 TRX = 1,000,000 sun).
Send Native TRX
You can transfer TRX to a recipient address using account.sendTransaction():
const result = await account.sendTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000 // 1 TRX in sun
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee, 'sun')
console.log('Activation fee:', result.activationFee, 'sun')Send Smart-Contract Calls
sendTransaction(), quoteSendTransaction(), and signTransaction() also accept smart-contract call descriptors. WDK builds a TronWeb TriggerSmartContract transaction from the contract address, function selector, parameters, and optional trigger options.
const result = await account.sendTransaction({
contractAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
functionSelector: 'transfer(address,uint256)',
parameters: [
{ type: 'address', value: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH' },
{ type: 'uint256', value: 1000000 }
],
options: {
feeLimit: 20_000_000
}
})
console.log('Transaction hash:', result.hash)
console.log('Total fee:', result.fee, 'sun')Smart-contract quotes include bandwidth plus the net energy cost after the sender's available resources are considered.
Send Pre-built TronWeb Transactions
Pass a pre-built TronWeb transaction when you need a transaction type that WDK does not model directly, such as staking or voting. This example uses sendTrx() for brevity; the same pattern works with other TronWeb transaction-builder methods that return an unsigned transaction owned by the account.
const address = await account.getAddress()
const transaction = await tronWeb.transactionBuilder.sendTrx(
'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
1_000_000,
address
)
const result = await account.sendTransaction(transaction)
console.log('Transaction hash:', result.hash)Before signing or sending a pre-built transaction, WDK checks that the transaction owner address matches the wallet account address.
Estimate Transaction Fees
You can get a fee estimate before sending using account.quoteSendTransaction(). For native TRX transfers, the quote includes activationFee, which is non-zero when the recipient account must be activated:
const quote = await account.quoteSendTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000
})
console.log('Estimated fee:', quote.fee, 'sun')
console.log('Activation fee:', quote.activationFee, 'sun')Cap Transaction Fees
Set transactionMaxFee when you create the wallet to stop sendTransaction() and signTransaction() calls if the estimated fee exceeds your limit.
const wallet = new WalletManagerTron(seedPhrase, {
provider: 'https://api.trongrid.io',
transactionMaxFee: 10000000n
})Sign Without Broadcasting
Use account.signTransaction() when you need a signed Tron transaction but do not want WDK to broadcast it.
const signedTransaction = await account.signTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000
})
console.log('Signed transaction:', signedTransaction)Use Dynamic Fee Rates
You can retrieve current fee rates from the wallet manager using wallet.getFeeRates():
const feeRates = await wallet.getFeeRates()
console.log('Normal fee rate:', feeRates.normal, 'sun')
console.log('Fast fee rate:', feeRates.fast, 'sun')Next Steps
To transfer TRC20 tokens instead of native TRX, see Transfer TRC20 Tokens.