TRON - Transferring Fungible Tokens (TRC-10 & TRC-20)

This article covers what steps you need to follow to transfer Tron-compatible Fungible Tokens (TRC-10 and TRC-20).

πŸ“˜

The following steps and examples are based on Shasta Tron (Testnet).

Steps

Step_1: Gather the transfer parameter details

  1. Confirm the "Token contract address".
  2. Confirm the Sender's blockchain address.
  3. Confirm the PrivateKey to sign the transaction is matching with the Sender's blockchain address.
  4. Confirm the Recipient blockchain address.

Step_2: Check the Native asset and Token balances of a Tron address

Token transfer gas fees are paid with Native chain assets.

  • Make sure the Sender's blockchain address has enough Native assets to cover the gas fees of the transfer.
  • Make sure the Sender's blockchain address has enough Token assets for the transfer.

Example request:

  • Returns address balance in Native and token assets
curl --location 'https://api.tatum.io/v3/tron/account/TJWCFsbeK6aybMTnsis1mccNX4gjW4ecah' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
    "assetIssuedId": "31303031333838",
    "assetIssuedName": "4f5a595f544f4b454e",
    "balance": 29127653860, // Native Balance
    "createTime": 1668192183000,
    "trc10": [                   //TRC-10 Balances
        {
            "value": 992000000000,
            "key": "1001388"    // TRC-10 TokenId
        }
    ],
    "trc20": [                  //TRC-20 Balances
        {
            "TXBTMbF796yDjCxveneH3XPchKc9mYfKyU": "9989890000000000" //TRC-20 Contract Addresses and Balances
        },
        {
            "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id": "4749000000"
        },
        {
            "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs": "12373507649"
        }
    ],
    "freeNetLimit": 600,
    "bandwidth": 600
}

🚧

Tron addresses with no TRX will return an error in fetching balance. The address must be "activated" first. Additional information is available in the following article.

Step_3_A: Transfer TRC-10 from a Tron address

Request example:

  • Returns the hash (ID) of the transfer transaction
curl --location 'https://api.tatum.io/v3/tron/trc10/transaction' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '
{
  "fromPrivateKey": "SENDER_ADDRESS_PRIVATE_KEY",
  "to": "TF48MUvZhSDpLFfC414b94Nj4LwqBFbXom",
  "tokenId": "1001388", //TRC-10 TokenId
  "amount": "100"
}'
//response:
{
    "txId": "856db9686309886f65f8e87eb4164ac5e89838f555ccdf70fdf07083ff22f67f"
}

Step_3_B: Transfer TRC-20 from a Tron address

Request Example:

  • Returns the hash (ID) of the transfer transaction
curl --location 'https://api.tatum.io/v3/tron/trc20/transaction' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '
{
  "fromPrivateKey": "SENDER_ADDRESS_PRIVATE_KEY",
  "to": "TF48MUvZhSDpLFfC414b94Nj4LwqBFbXom",
  "tokenAddress": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs", //TRC-20 Smart Contract Address
  "feeLimit": 100,
  "amount": "100.123456" // The token supports 6 decimals (see Token Contract)
}'
//Response:
{
    "txId": "f33291c1449ee0742748a168992530a5de83e33533900bf39052a43fdb32a909"
}

πŸ“˜

Mind the Token decimals.

Step_4: Get the details of a transaction

Request example:

curl --location 'https://api.tatum.io/v3/tron/transaction/856db9686309886f65f8e87eb4164ac5e89838f555ccdf70fdf07083ff22f67f' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
    "ret": [
        {
            "contractRet": "SUCCESS"
        }
    ],
    "signature": [
        "c8244deebfded16236e912c466ded136d987e486e0fee2602e8cfc9ac072b2940d7007e82bb10e65a3a67dcb403aa4d2b28ab2a58b6c848a4e739e21b3b44a371b"
    ],
    "blockNumber": 45254767,
    "txID": "856db9686309886f65f8e87eb4164ac5e89838f555ccdf70fdf07083ff22f67f",
    "netUsage": 282,
    "rawData": {
        "contract": [
            {
                "parameter": {
                    "value": {
                        "amount": 100000000,
                        "asset_name": "31303031333838",
                        "owner_address": "415d9d478fdf818f93c9c52c74da21f8a66a19b92d",
                        "to_address": "4137c6d4314d14dfdc8502e5487240dfb0eabd169d",
                        "assetNameUtf8": "31303031333838",
                        "ownerAddressBase58": "TJWCFsbeK6aybMTnsis1mccNX4gjW4ecah",
                        "toAddressBase58": "TF48MUvZhSDpLFfC414b94Nj4LwqBFbXom"
                    },
                    "type_url": "type.googleapis.com/protocol.TransferAssetContract"
                },
                "type": "TransferAssetContract"
            }
        ],
        "ref_block_bytes": "886d",
        "ref_block_hash": "089c7a8bb7863e7c",
        "expiration": 1719321903000,
        "timestamp": 1719321843000
    }
}
curl --location 'https://api.tatum.io/v3/tron/transaction/ac1399ed78eea2fd2ade558b93f7fd7743f9c0f5cbeca39ed73d6675b54fd66d' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
    "ret": [
        {
            "contractRet": "SUCCESS"
        }
    ],
    "signature": [
        "7f6a10136a8e660eefcb5ce79b52964a5e93d6259612f394d8ac27d8793e836366fa6f1c92eea4ebd8b4d5e6f21cc6b9024badf0ef8a0921d52718df95fa6bc11b"
    ],
    "blockNumber": 45254893,
    "txID": "ac1399ed78eea2fd2ade558b93f7fd7743f9c0f5cbeca39ed73d6675b54fd66d",
    "netFee": 345000,
    "fee": 12123900,
    "energyFee": 11778900,
    "energyUsageTotal": 28045,
    "rawData": {
        "contract": [
            {
                "parameter": {
                    "value": {
                        "data": "a9059cbb00000000000000000000000037c6d4314d14dfdc8502e5487240dfb0eabd169d0000000000000000000000000000000000000000000000000000000005f5e100",
                        "owner_address": "415d9d478fdf818f93c9c52c74da21f8a66a19b92d",
                        "contract_address": "4142a1e39aefa49290f2b3f9ed688d7cecf86cd6e0",
                        "ownerAddressBase58": "TJWCFsbeK6aybMTnsis1mccNX4gjW4ecah",
                        "contractAddressBase58": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs"
                    },
                    "type_url": "type.googleapis.com/protocol.TriggerSmartContract"
                },
                "type": "TriggerSmartContract"
            }
        ],
        "ref_block_bytes": "88da",
        "ref_block_hash": "2771b4d626e1c72b",
        "expiration": 1719322290000,
        "fee_limit": 100000000,
        "timestamp": 1719322231145
    },
    "log": [
        {
            "address": "42a1e39aefa49290f2b3f9ed688d7cecf86cd6e0",
            "topics": [
                "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0000000000000000000000005d9d478fdf818f93c9c52c74da21f8a66a19b92d",
                "00000000000000000000000037c6d4314d14dfdc8502e5487240dfb0eabd169d"
            ],
            "data": "0000000000000000000000000000000000000000000000000000000005f5e100"
        }
    ]
}

Good to Know

  • Fee Estimates for Tron Token transfers are challenging to calculate. Find additional information in the following article.
  • The Testnet Fee Estimate is generally unreliable. Since testnet coins have "no value", users tend to set random amounts greatly skewing the estimates.
  • Be mindful of Tatum's derivation path. Find additional information in the following article.
  • Familiarize yourself with the Safety & Security Basics in the following article.

Error Troubleshooting