buildTransaction
The buildTransaction method is a Tron-specific RPC method that helps construct transactions for the Tron network. This method simplifies the transaction building process by handling the complex transaction structure required by Tron, including setting proper timestamps, expiration times, and reference blocks.
Unlike Ethereum where transactions are simpler, Tron transactions require additional fields such as reference block information and expiration timestamps. The buildTransaction method automates this process, making it easier for developers to create valid Tron transactions that will be accepted by the network. This is particularly useful for applications that need to programmatically create and sign transactions.
The method is essential for wallet applications, payment processors, and any dApp that needs to execute transactions on the Tron network through the TVM (Tron Virtual Machine).
Parameters
parameter | type | description |
|---|---|---|
transaction | object | Transaction object containing from, to, value, and other transaction parameters |
transaction.from | string | Sender's Tron address |
transaction.to | string | Recipient's Tron address |
transaction.value | string | Amount to transfer in sun (1 TRX = 1,000,000 sun) |
transaction.data | string | Optional contract call data |
Return Object
field | type | description |
|---|---|---|
txID | string | Transaction hash identifier |
raw_data | object | Raw transaction data ready for signing |
raw_data_hex | string | Hexadecimal representation of raw data |
Request Example
Response Example