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. For TRX consolidation, only addresses with more than 1 TRX are eligible to be consolidated.

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

Note: In order to enable automatic TRX funding on receive address from gas tank, reach out to support@bitgo.com

TRON wallets at BitGo utilize a Gas Tank to cover token consolidation fees, but not other transaction fees. The estimated gas for a token consolidation transaction is 36 TRX (the actual gas may be less). For this reason, TRON receive addresses need have a minimum balance of 36 TRX per unique token to be consolidated. Whenever a receive address gets a token deposit, gas tank will calculate the amount of TRX needed on the receive address to consolidate the token, and will initiate a transaction to fund the receive address with the calculated differential amount. Some example scenarios:

  • If a receive address gets USDC and has 0 TRX, the gas tank will fund the receive address with 36 TRX
  • If a receive address gets USDC and has 20 TRX, the gas tank will fund the receive address with 16 TRX
  • If a receive address gets both USDC and USDT and has 0 TRX, the gas tank will fund the receive address with 72 TRX
  • If a receive address gets both USDC and USDT and has 20 TRX, the gas tank will fund the receive address with 52 TRX

In order for the gas tank -> receive address funding to happen smoothly, keep your gas tank appropriately funded. 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 fund the receive address, you must manually deposit TRX into impacted receive addresses. Replenishing the gas tank doesn't automatically fund the receive addresses, because the gas tank will only fund a receive address when there has been a token deposit.

While using the gas tank feature to fund receive addresses on token deposit, always consolidate tokens before TRX. This is because, if TRX is consolidated first, only the TRX which won't be needed for token consolidation fees will be pulled out. Example scenario:

  • If a receive address has 1 USDT and 48 TRX, and consolidation is attempted for TRX, only 12 (48-36) TRX will be consolidated to the root address
  • Any subsequent attempts to consolidate TRX will not pull out any TRX, though TRX balance on the receive address will show up as ~36 TRX
  • Conversely, if USDT is consolidated first, followed by TRX consolidation, any remaining TRX will be consolidated to the root address

This is because of the above mechanism which ensures that receive addresses have enough TRX to cover for token consolidation fees