Tron

TRON

TRON (TRX) can be accessed with the following coin types:

EnvironmentCoin TypeFaucet
TRON Productiontrx
TRON Testnetttrxhttps://developers.tron.network/docs/networks#testnet

Explorer

https://tronscan.org/

Generating wallets

To create an Tron wallet using BitGoJS:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 bitgo .coin('ttrx') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', }) .then(function (wallet) { // print the new wallet console.dir(wallet); // print the new wallets address to send to console.dir(wallet.coinSpecific.rootAddress); });

You need to fund the wallet with 100 TRX as wallet creation costs this much for an individual user. You can find the address to fill on the rootAddress field above. TRON accounts must also maintain a minimum balance of 0.1 TRX or else the account will become deactivated and will not read data from the Tron blockchain.

To create an TRON wallet using the platform API:

1 2 3 4 5 6 7 8 LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/ttrx/wallet/generate

A similar operation will need to be provided above to the resultant rootAddress.

Creating addresses

BitGo supports multiple receive addresses for Tron. To create a new receive address in your TRX Wallet:

1 2 const address = await wallet.createAddress({ label: 'My address' }); console.log(address);

TRX and Token Withdrawal

You can send native TRX and TERC20 tokens with the .sendMany() method. However, TRX transactions support sending to only 1 recipient.

1 2 3 4 5 6 7 8 9 10 11 12 const coin = 'ttrx:usdc'; // coin can be ttrx, trx or token name const basecoin = bitgo.coin(coin); const transaction = yield walletInstance.sendMany({ recipients: [ { amount: '10341234', address: 'TMtA4FQRddJaQ37yrdMmNsuC3jbkCs2Brt', }, ], walletPassphrase: walletPassphrase, type: 'TokenTransfer', });

Balances

Tronix (TRX) is the native asset of the TRON blockchain. The base unit of Tronix is sun:

  • 1 sun is (10-6) or 0.000001 Tronix.
  • 1 Tronix is (106) or 1000000 sun (1 million).

Balances are supported in string format: balanceString, confirmedBalanceString, and spendableBalanceString.

To obtain TRX and token balances for an entire wallet using BitGoJS:

1 2 3 const basecoin = bitgo.coin(coin); const walletInfo = basecoin.wallets().get({ id: walletId, allTokens: true }); // walletInfo.tokens() will return complete Tron Token information, including balances

You can also get balances (both native and tokens) based solely off address:

1 2 3 const address = yield walletInstance.getAddress({ address: 'TTwW9apvyVL9EBqDVeTVDft15hf1Jnkpzy' }); const bal = address.balance; return bal;

Fees

Tron uses a resource model based on bandwidth and energy to handle the cost of TRX transfer and smart contract transactions.

Bandwidth is the unit that measures the size of the transaction bytes stored in the blockchain database.

An account receives 600 free bandwidth points per day. When the available bandwidth is not enough to pay for the transaction, TRX is burned.

Energy is the unit that measures the computational resources required to execute smart contracts.

Energy can only be obtained by staking TRX. When energy is not available, TRX is burned. The energy quantity is calculated when the contract is executed. The energy consumption is also affected by the contract's energy_factor, which is determined by the complexity of the contract.

Because exact fee calculation involves several variables and the system also burns the TRX paid if the transaction fails to execute successfully, BitGo uses a maximum fee approach to ensure transactions do not fail due to insufficient fees. The network calculates and burns only the cost of the transaction.

  • Transfer fee:
    • 2100000 sun (2.1 TRX) for TRX transactions
    • 35834875 sun (35.834875 TRX) for USDT token transactions
    • 17021500 sun (17.0215 TRX) for USDC token transactions
  • Wallet initialization fee:
    • 100000000 sun (100 TRX)

How to do a consolidation for TRX and TRON Tokens

To consolidate your receive address balances into the root address, enter the coin as TRX, or a Tron Token (trx:usdt, trx:usdc).

Note: It's recommended to consolidate tokens and then consolidate the remaining TRX in order to minimize the dust left on the address.

1 2 3 4 5 6 7 8 9 10 const consolidationTxes = await wallet.buildAccountConsolidations(); try { for (const unsignedConsolidation of consolidationTxes) { const res = await wallet.sendAccountConsolidation({ walletPassphrase, prebuildTx: unsignedConsolidation }); console.dir(res, { depth: 6 }); } } catch (e) { console.error(e); }

Gas Tank

TRON wallets at BitGo utilize a Gas Tank to cover consolidation fees, but not other transaction fees. Consolidations automatically occur any time a unique token deposits into a receive address. The estimated gas for a consolidation transaction is 36 TRX (the actual gas may be less). For this reason, TRON receive addresses have a minimum balance of 36 TRX per unique token. For example:

  • If USDC deposits into a receive address, BitGo automatically consolidates the balance to the root address, and the gas tank replenishes the receive address with 36 TRX.
  • If USDC and USDT deposit into the same receive address, BitGo automatically consolidates the balances to the root address, and the gas tank replenishes the receive address with 72 TRX.

Keep your gas tank appropriately funded to ensure streamlined consolidations. BitGo recommends a minimum gas-tank balance of:

the average number of consolidations per cycle x 1.5 x 36

Note: If your gas tank balance is too low to pay for consolidations, you must manually deposit TRX into impacted receive addresses. Replenishing the gas tank doesn't automatically resume consolidations for receive addresses that failed to automatically consolidate due to insufficient TRX balances.

If manually consolidating, always consolidate tokens before TRX. If a receive address has a balance of 0 TRX, you can't complete any token consolidations.