Skip to main content
TRON API method that executes a token swap transaction on the TRON decentralized exchange.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • owner_address — the address performing the token swap (base58 with visible: true, or hex with visible: false).
  • exchange_id — unique identifier of the exchange pair to trade on.
  • token_id — token ID being sold; use _ to denote TRX.
  • quant — integer amount being sold (token base units; if TRX, specify in sun).
  • expected — integer minimum to receive (token base units; if TRX, sun). Protects against slippage.
  • permission_id — optional permission ID for multi‑signature accounts.

Response

Returns a transaction object containing:
  • txID — unique transaction identifier
  • raw_data — raw transaction data including contract details
  • raw_data_hex — hexadecimal representation of raw transaction data

Use case

The wallet/exchangetransaction method is used for:
  • Swapping tokens directly on the TRON decentralized exchange
  • Converting between TRX and TRC20 tokens at current market rates
  • Building arbitrage bots and automated trading strategies
  • Implementing token exchange functionality in decentralized applications

curl example

Shell
curl --request POST \
  --url 'https://tron-mainnet.core.chainstack.com/95e61622bf6a8af293978377718e3b77/wallet/exchangetransaction' \
  --header 'Content-Type: application/json' \
  --data '{
  "owner_address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
  "exchange_id": 1,
  "token_id": "1000001",
  "quant": 100000000000,
  "expected": 95000000,
  "visible": true
}'
  • amounts must be integers (do not quote numbers). If TRX is involved (token_id is ”_” on either side of the pair), express TRX values in sun (1 TRX = 1,000,000 sun).
  • the call returns an unsigned transaction; sign and broadcast it. On mainnet, the exchange must exist and you must have sufficient balance; slippage protection may reject if market has moved.