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, quote and send a signed transaction, track finality, 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 this wallet signs or sends an unsigned pre-built transaction, WDK verifies that its txID matches its serialized raw data and that the transaction owner address matches the wallet account address. A transaction that is already signed is quoted and broadcast unchanged; this unsigned-input integrity guard is not repeated on that direct-broadcast path.
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)Quote and Send a Signed Transaction
Pass the TronSignedTransaction returned by signTransaction() to the quote and send methods when review and submission are separate steps.
const signedTransaction = await account.signTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000
})
const quote = await account.quoteSendTransaction(signedTransaction)
console.log('Estimated fee:', quote.fee, 'sun')
const result = await account.sendTransaction(signedTransaction)
console.log('Transaction hash:', result.hash)WDK forwards a signed object unchanged and does not refresh its reference block or expiration, re-sign it, or repeat the unsigned raw-data and owner-address checks. Validate that the signed transaction belongs to the intended account and submit it while it remains valid. sendTransaction() quotes it again and enforces transactionMaxFee.
Track Transaction Finality
Pass the returned TRON transaction ID to getTransaction() for one lookup or waitForTransaction() to poll. A transaction progresses from pending to confirmed, then becomes final when its block is solidified:
const transaction = await account.waitForTransaction(result.hash, {
target: 'final',
timeout: 180000
})
if (transaction.success === false) {
console.error('The transaction was included but execution failed')
}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.