How to Send USDT on TRON with Go

USDT on TRON (TRC20) is one of the most transferred tokens in crypto. This guide shows you how to send USDT programmatically using Go and the GoTRON SDK.

Prerequisites

  • Go 1.24+
  • GoTRON SDK installed: go get github.com/fbsobreira/gotron-sdk
  • A funded TRON account with enough TRX for energy/bandwidth

USDT Contract Address

The official USDT TRC20 contract on TRON mainnet:

TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Check USDT Balance

Before sending, check the sender’s USDT balance:

package main

import (
    "fmt"
    "log"
    "math/big"

    "github.com/fbsobreira/gotron-sdk/pkg/client"
)

func main() {
    conn := client.NewGrpcClient("grpc.trongrid.io:50051")
    if err := conn.Start(); err != nil {
        log.Fatal(err)
    }
    defer conn.Stop()

    usdtContract := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    address := "YOUR_TRON_ADDRESS"

    balance, err := conn.TRC20ContractBalance(address, usdtContract)
    if err != nil {
        log.Fatal(err)
    }

    // USDT has 6 decimals
    decimals := new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil))
    human := new(big.Float).Quo(new(big.Float).SetInt(balance), decimals)

    fmt.Printf("USDT Balance: %s\n", human.Text('f', 6))
}

Send USDT

package main

import (
    "fmt"
    "log"
    "math/big"

    "github.com/fbsobreira/gotron-sdk/pkg/client"
    "github.com/fbsobreira/gotron-sdk/pkg/keystore"
)

func main() {
    conn := client.NewGrpcClient("grpc.trongrid.io:50051")
    if err := conn.Start(); err != nil {
        log.Fatal(err)
    }
    defer conn.Stop()

    usdtContract := "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    from := "SENDER_ADDRESS"
    to := "RECIPIENT_ADDRESS"
    amount := big.NewInt(10_000_000) // 10 USDT (6 decimals)
    feeLimit := int64(100_000_000)   // 100 TRX fee limit

    // Create unsigned transaction
    tx, err := conn.TRC20Send(from, to, usdtContract, amount, feeLimit)
    if err != nil {
        log.Fatal(err)
    }

    // Sign with keystore
    ks := keystore.NewKeyStore("./keystore")
    account := ks.Accounts()[0]
    signedTx, err := ks.SignTx(account, tx.Transaction)
    if err != nil {
        log.Fatal(err)
    }

    // Broadcast
    result, err := conn.Broadcast(signedTx)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Transaction sent: %v\n", result)
}

Estimate Energy Cost

TRC20 transfers require energy. Estimate the cost before sending:

resource, err := conn.GetAccountResource("SENDER_ADDRESS")
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Energy available: %d / %d\n",
    resource.GetEnergyLimit()-resource.GetEnergyUsed(),
    resource.GetEnergyLimit(),
)

A typical USDT transfer costs ~65,000 energy. If you don’t have enough staked energy, TRX will be burned to cover the cost.

Error Handling

Common errors and solutions:

ErrorCauseSolution
BANDWITH_ERRORInsufficient bandwidthStake TRX for bandwidth or keep TRX for fees
CONTRACT_VALIDATE_ERRORInvalid parametersCheck addresses and amount formatting
ENERGY_NOT_ENOUGHInsufficient energyStake TRX for energy or increase fee limit

Next Steps