Features
API Transaction Builder โ Generate Tron Transaction JSON
If your app is already able to build tron transactions, you don't need to utilize the transaction builder. This feture is for projects that are completely new to tron transactions to simplify the transaction payload generation.
#๐งพ Input Required
- A Sender Adress
- A Receiver Address
- The amount you want to send
- For TRC20 and TRC721 transactions: The Smart Contract Address
- Fopr TRC10 and TRC721 transactions: The TokenId
#How It Works
The Transaction Builder provides a simple API endpoint to generate raw Tron transactions. This is particularly useful for developers who are new to Tron or want to streamline the transaction creation process without dealing with the complexities of raw transaction payloads.
You can use the /transactions/build
endpoint to create various types of transactions, including TRX, TRC10, TRC20, and TRC721 transfers.
#Example Request
1POST /transactions/build
2Host: tronfuel.dev
3Authorization: Bearer YOUR_API_KEY
4Content-Type: application/json
5
6{
7 "type": "TRC20",
8 "sender_address": "TSSMh4g9D2C1Jg9J3g9J3g9J3g9J3g9J3g9J3g9J3",
9 "receiver_address": "TSSMh4g9D2C1Jg9J3g9J3g9J3g9J3g9J3g9J3g9J3",
10 "amount": "1000000",
11 "contract": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
12}
#Example Response
The API will return a raw Tron transaction JSON object, which you can then sign and broadcast.
1{
2 "raw_data": {
3 "contract": [
4 {
5 "parameter": {
6 "value": {
7 "amount": 1000000,
8 "owner_address": "415b3648679f225021200000000000000000000000",
9 "to_address": "415b3648679f225021200000000000000000000000"
10 },
11 "type_url": "type.googleapis.com/protocol.TransferContract"
12 },
13 "type": "TransferContract"
14 }
15 ],
16 "ref_block_bytes": "0000",
17 "ref_block_hash": "0000000000000000",
18 "expiration": 1678886400000,
19 "timestamp": 1678886340000
20 },
21 "raw_data_hex": "0a020000..."
22}
Once you have the raw transaction, you can proceed to sign it with your private key and then send it to the Tron network.