Tronergydocs

Send USDT

Relay a user-signed USDT transfer and pay the network cost yourself.

This is the main flow. It uses the sponsored_broadcast mode: your user signs one transaction, and you pay the energy and bandwidth from your balance. The user needs zero TRX.

It works for any smart-contract call, not only USDT.

Build the transaction

Ask Tronergy for an unsigned transfer. It also returns a cost estimate.

Terminal
curl -X POST https://apiv2.tronergy.io/api/chain_relayers/portal/construct-tx \
  -H "x-api-key: $TRONERGY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "chain": "tron",
    "mode": "sponsored_broadcast",
    "environment": "live",
    "senderAddress": "TXyz...",
    "contractAddress": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
    "functionSelector": "transfer(address,uint256)",
    "parameter": [
      { "type": "address", "value": "TAbc..." },
      { "type": "uint256", "value": "25000000" }
    ]
  }'

Use built.estimate.estimatedCostNative to show the cost in TRX. The transaction lives about 5 minutes (expiresAt).

Sign it

Sign the transaction exactly as returned. Do not change it after signing.

wallet.ts
// Send unsignedTx to your frontend. TronLink and similar wallets expose tronWeb.
const signedTx = await window.tronWeb.trx.sign(unsignedTx)
// Send signedTx back to your backend.

Check that the wallet is on the network in built.expectedNetworkId before the user signs.

Execute

Send the signed transaction from your backend. Use a new UUID as idempotencyKey and save it. If the request times out, retry with the same key.

Terminal
curl -X POST https://apiv2.tronergy.io/api/chain_relayers/portal/execute \
  -H "x-api-key: $TRONERGY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "chain": "tron",
    "mode": "sponsored_broadcast",
    "environment": "live",
    "idempotencyKey": "6f1c2c3e-8a1b-4d7e-9a43-2b1f0c9d8e77",
    "payload": { "signed_tx": { "txID": "...", "raw_data": {}, "raw_data_hex": "...", "signature": ["..."] } }
  }'

You get 202 with { ok, operationId, status: "pending", estimate }. The relay runs in the background.

Wait for the result

Poll GET /chain_relayers/portal/operations/{id} every 2 seconds until the status is completed, failed, voided or expired. On completed, txHash is your user's transaction.

See Track status for polling code and live streams.

Get the result in one call

Add "sync": true to execute. The API waits up to 5 seconds (syncTimeoutMs, max 8000).

  • 200 with settled: true: done. txHash is set if it completed.
  • 202 with settled: false: still running. Poll as usual.

Check the price first

Call estimate to price a transaction before you execute. execute makes its own fresh quote, and that quote is what you pay. See Billing. To show the current energy price without an API key, use Pricing.