Cross Chain Swaps from Tron
The 0x Cross-Chain API is in private beta. Request access to start building.
Quick link with examples: 0x-examples
Steps to Cross Chain Swap Tokens from Tron
This guide will walk you through using the /quotes and /status endpoints on 0x’s Cross Chain API to:
- Fetch a quote
- Build and sign a transaction
- Broadcast and confirm the transaction
- Monitor the status of the cross chain swap
In our example, we will be swapping USDT on Tron to USDC on Arbitrum. For understanding how to deal with the native TRX, please refer to Native Tokens Handling.
0. Prerequisites
Make sure you have:
- A funded Tron wallet (with TRX for energy/bandwidth fees)
- 0x API key
- A connection to a Tron full-node HTTP API (see details below)
- TronWeb library (used for address conversion, signing, and broadcasting)
Set up a Tron connection
Tron provides a public full-node HTTP API, but for production use, it’s strongly recommended to use a dedicated provider such as TronGrid or run your own Tron full node.
Tron transactions are built via the HTTP API endpoint wallet/triggersmartcontract, then signed and broadcast using TronWeb helpers.
Understanding Tron fees
Unlike EVM chains, Tron uses an energy and bandwidth model instead of gas:
- Bandwidth — consumed when broadcasting any transaction. Free bandwidth is available from staking TRX.
- Energy — consumed when executing smart contract calls. Can be obtained by staking TRX or paid in TRX directly.
If your wallet does not have enough staked TRX to cover energy/bandwidth, the required TRX will be burned from your balance automatically. For cross-chain swaps, make sure your wallet has sufficient TRX to cover these fees.
1. Fetch a Quote
Start by sending a GET request to the 0x /quotes endpoint to get a quote for a specific token and chain pair with a selected amount. You may use 'tron' or '999999999993' as the originChain. Tron addresses use the Base58Check format (e.g. TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t).
Example response
Unlike EVM chains, Tron cross-chain swaps do not require token approvals. The API uses deposit-only transactions, so there is no allowanceTarget and no approval step needed.
2. Build and sign the transaction
Tron transactions follow a different flow than EVM or Solana. Instead of receiving a pre-built serialized transaction, you receive the contract call parameters (to, data, value, ownerAddress) and use them to build a transaction via the Tron HTTP API.
The recommended approach is to call the Tron HTTP API directly for building the transaction, then use TronWeb for signing:
3. Broadcast and confirm the transaction
After signing, broadcast the transaction and poll for confirmation. Tron blocks are produced approximately every 3 seconds.
4. Monitor the cross chain execution
The last step is to monitor the execution of the cross chain transaction, including the fill on the destination chain. For that, we will use the /status endpoint.
When using the /status endpoint for Tron-originated transactions, pass the transaction hash as a hex string prefixed with 0x (64 hex characters).
In your application, you might need to monitor the status repeatedly, as bridging operation might take several seconds or minutes to complete.