POSTbuildTransaction

Tron Mainnethttps://tron-mainnet.nodit.io/

Creates an unsigned TRON transaction. The combination of fields you provide determines the transaction type, and each type requires different parameters.

  • TransferContract: Transfers TRX. (from, to, value)
  • TransferAssetContract: Transfers a TRC-10 token. (from, to, tokenId, tokenValue)
  • CreateSmartContract: Deploys a smart contract. (from, name, gas, abi, data)
  • TriggerSmartContract: Calls a smart contract function. (from, to, data, gas)
Request Body
idintegerrequired
jsonrpcstringrequired
methodstringrequired
paramsoneOf[]required

It contains following parameter in order:

  1. transactionObject: The transaction to create, as an object. (required) Because the required fields differ by transaction type, choose one of the four variants below.
params[0]object
fromstringrequired

The address of the account sending the transaction.

tostringrequired

The address of the account that will receive the TRX.

valuestringrequired

The amount of TRX to transfer, in sun, passed in hexadecimal.

Responses
visibleboolean

Whether addresses are shown in Base58 form.

txIDstring

The transaction ID.

contract_addressstring

The address of the contract to be created when the transaction creates one.

raw_dataobject

The raw data of the transaction.

contractobject[]

The list of contracts included in the transaction.

typestring

The contract type. (e.g.) TransferContract, TriggerSmartContract

parameterobject

The parameters specific to the contract type.

type_urlstring

The URL that identifies the contract type.

valueobject

The parameter value, whose layout depends on the contract type.

ref_block_bytesstring

The lower 2 bytes of the reference block number.

ref_block_hashstring

Part of the reference block hash.

expirationinteger

The transaction expiration time, in milliseconds.

timestampinteger

The transaction creation time, in milliseconds.

fee_limitinteger

The maximum fee allowed for contract execution, in sun.

raw_data_hexstring

The raw data hex-encoded. This is the data that gets signed.

X-API-KEY
RequestCU30
cURL
curl -X POST "https://tron-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "buildTransaction",
  "params": [
    {
      "from": "0xc4db2c9dfbcb6aa344793f1dda7bd656598a06d8",
      "to": "0x95fd23d3d2221cfef64167938de5e62074719e54",
      "value": "0x1f4"
    }
  ]
}'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "transaction": {
      "visible": false,
      "txID": "ae02a80abd985a6f05478b9bbf04706f00cdbf71e38c77d21ed77e44c634cef9",
      "raw_data": {
        "contract": [
          {
            "type": "TransferContract",
            "parameter": {
              "type_url": "type.googleapis.com/protocol.TransferContract",
              "value": {
                "amount": 500,
                "owner_address": "41c4db2c9dfbcb6aa344793f1dda7bd656598a06d8",
                "to_address": "4195fd23d3d2221cfef64167938de5e62074719e54"
              }
            }
          }
        ],
        "ref_block_bytes": "957e",
        "ref_block_hash": "3922d8c0d28b5283",
        "expiration": 1684469286000,
        "timestamp": 1684469226841
      },
      "raw_data_hex": "0a02957e22083922d8c0d28b528340f088c69183315a66080112620a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e7472616374"
    }
  }
}