WDK
Tron Gasless Transactions in WDK
Tether's Developer Relations

Tron Gasless Transactions in WDK

Raquel Carrasco Gonzalez
Article byRaquel Carrasco GonzalezDeveloper Relations Services

In this post, we will cover Gasless transactions on the Tron chain using the WDK wallet modules.

TRON is the chain where USD₮ moves the most, and where "you need TRX for gas" hurts the most. In this post, we'll set up @tetherto/wdk-wallet-tron-gasfree, get credentials from GasFree.io, and send USD₮ (TRC20) with the fee paid in USD₮. No TRX, ever.

Step 1: Understand How GasFree Works

GasFree is a service that lets users sign token transfers off-chain, while a service provider submits and pays for the transaction on-chain:

  1. The user signs a TRC20 transfer message, this happens off-chain, so it costs nothing
  2. The GasFree service provider submits it on-chain and pays the TRX
  3. A small handling fee is deducted from the user's USD₮ in the same transfer

From the user's perspective: no TRX needed, ever. Unlike EVM (bundler + paymaster) and TON (protocol paymaster), TRON's approach is a dedicated relaying service, which is why the credentials here are an API key/secret pair rather than an RPC endpoint.

GasFree works on both the TRON Mainnet and the Nile Testnet.

Step 2: Get Your API Keys

GasFree credentials are managed through the GasFree Developer Center, a self-service dashboard where you register and receive your API keys instantly.

GasFree Landing

Steps:

  1. Go to https://developer.gasfree.io and sign up with your email
  2. Confirm your email and sign in.
  3. Right after registering, the first time you log in, a "Save New API Key" pop-up shows your credentials: an API Key and API Secret for TRON Mainnet, and a separate pair for the Nile Testnet.
New API keys from GasFree.
⚠️ Copy and store all four values immediately, the pop-up warns you they will not be shown again after you close it. The dashboard lets you manage your application afterward (rate limits, transaction stats), but it never re-displays the secrets. Store them in a password manager or your secrets vault, and load them into your app from environment variables.

That's it, no forms, no waiting. Your application is created automatically with default rate limits (5 requests/second, burst capacity of 10), which is plenty for development; contact the GasFree team through the Developer Center for production volumes.

A note on the dashboard: your account may show an "Under Validation" badge on your email after signup. This doesn't block your keys; they were already issued in the pop-up. And don't confuse the UID in Account Settings with your API Key; the UID is just your account identifier.

You don't need to handle how the credentials sign requests (HMAC-SHA256 per the GasFree spec), the WDK module does authentication for you; just drop the key and secret into the config.

Start on the Nile testnet

Validate the whole flow with your testnet pair before touching the mainnet:

Get test TRX and USD₮ from the Nile faucet. One recommendation from the GasFree docs: the testnet environment is for developer testing only; if your app exposes a testnet mode during development, close it off before launch.

Quick Reference


Testnet (Nile)

Mainnet

Provider

https://nile.trongrid.io

https://api.trongrid.io

GasFree endpoint

https://open-test.gasfree.io/nile/

https://open.gasfree.io/tron/

API Key & Secret

Registration pop-up (Nile pair)

Registration pop-up (Mainnet pair)

Verifying contract

THQGuFzL87ZqhxkgqYEryRAd7gqFqL5rdc

TFFAMLQZybALab4uxHA9RBE7pxhUAjfF3U

Service provider

TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH

TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH

Step 3: Register the Gasless Wallet

Install the module in your project. We support Node.js and Bare runtimes. For more information, check Introduction to WDK: Tether's Wallet Development Kit.


npm install @tetherto/wdk @tetherto/wdk-wallet-tron-gasfree

Next, you will have to register the module with WDK. The process and structure are the same as with every other chain in this series; the only thing that changes is the configuration.


import WDK from '@tetherto/wdk'
import WalletManagerTronGasfree from '@tetherto/wdk-wallet-tron-gasfree'

const seedPhrase = 'your seed phrase here' // only for development and testing

const wdk = new WDK(seedPhrase)
  .registerWallet('tron-gasfree', WalletManagerTronGasfree, {
    provider: 'https://api.trongrid.io',
    gasFreeProvider: 'https://open.gasfree.io/tron/',
    gasFreeApiKey: 'your-production-key',
    gasFreeApiSecret: 'your-production-secret',
    serviceProvider: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
    verifyingContract: 'TFFAMLQZybALab4uxHA9RBE7pxhUAjfF3U'
  })

console.log('TRON GasFree wallet registered')

What's happening:

  • provider: the TRON RPC endpoint (TronGrid).
  • gasFreeProvider, gasFreeApiKey, gasFreeApiSecret: your GasFree.io credentials from Step 2.
  • serviceProvider: the GasFree account that submits and pays for transactions on-chain.
  • verifyingContract: the contract that verifies the user's off-chain signature.

Step 4: Send Your First Gas-Free Transaction

Once the wallet is registered, we can send USD₮ from an account that holds zero Tron. As always, we quote first, show users the exact cost before they commit:

const tronAccount = await wdk.getAccount('tron-gasfree', 0)
const usdtAddressTron = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' // USDT (TRC20)
const recipientTron = 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH'

// Estimate the fee first
const quote = await tronAccount.quoteTransfer({
  token: usdtAddressTron,
  recipient: recipientTron,
  amount: 1000000n // 1 USDT (6 decimals)
})

console.log('Handling fee:', Number(quote.fee) / 1e6, 'USDT')

// Send — GasFree submits it on-chain and covers the TRX
try {
  const result = await tronAccount.transfer({
    token: usdtAddressTron,
    recipient: recipientTron,
    amount: 1000000n
  }, {
    transferMaxFee: 500000n // optional per-call cap: 0.5 USDT
  })

  console.log('✅ Transaction hash:', result.hash)
  console.log('Fee paid:', Number(result.fee) / 1e6, 'USDT')
} catch (error) {
  console.error('Transfer failed:', error.message)
}


What's happening:

  • Token transfers use transfer() with token, recipient, and amount ; note that sendTransaction() is not supported in the TRON gasfree module; all sends go through the GasFree provider via transfer(). It's the same signature as the TON and Solana gasless modules.
  • token points to USD₮ on TRON (TRC20 standard), the same role as EVM's token contract address, a different address format.
  • The fee is GasFree's handling fee, charged in USD₮. Heads-up on the first transfer from a fresh account: GasFree accounts start inactive and are activated automatically during their first transfer, which adds a one-time activation fee on top of the transfer fee. Subsequent transfers only pay the transfer fee, so don't be surprised if the first quote comes back higher.
  • The optional second argument is a per-call override: here we cap this transfer's fee at 0.5 USD₮ with transferMaxFee.
  • result.hash is the transaction hash to track on a TRON explorer (e.g. Tronscan); result.fee is the actual fee paid.
  • TRON recipient addresses start with T and are 34 characters long, worth validating before sending:
function isValidTronAddress(address) {
  return typeof address === 'string' && address.startsWith('T') && address.length === 34
}


Common errors:

  • Auth errors (401/403): wrong API Key/Secret, or credentials from the wrong network. Remember the Developer Center issues separate pairs for Mainnet and Nile. Double-check you're using the pair that matches your endpoints.
  • sendTransaction() fails or is rejected: not supported in the gasfree module, use transfer().
  • "Insufficient balance": your USD₮ balance must cover the amount + fee (+ the activation fee if it's the account's first transfer).
  • Fee above transferMaxFee: first transfers quote higher due to activation, raise the cap for the first send or account for it in your UX.
  • Invalid recipient: check the T-prefix / 34-character format.
  • Wrong network mix: make sure chainId, provider, gasFreeProvider, verifyingContract, and your API key pair all match the same network (all-Nile or all-mainnet). Mixing them fails in confusing ways.

Key Insights

  • TRON gasless = off-chain signatures + a relaying service, not bundlers or protocol paymasters. You sign the TRC20 transfer off-chain; GasFree submits it on-chain and pays the TRX.
  • Keys are instant, but shown only once: the GasFree Developer Center issues your Mainnet and Nile Testnet credentials in a one-time pop-up right at registration; copy all four values immediately, because the dashboard never displays them again.
  • The first transfer costs more: GasFree accounts activate automatically on their first transfer, adding a one-time activation fee, TRON's version of the "expensive first transaction" we saw with ERC-4337 Smart Accounts.
  • serviceProvider and verifyingContract are canonical constants per network; copy them from the quick-reference table, don't guess, and keep every config value (including your API key pair) on the same network.
  • Same WDK pattern as every chain: register → getAccount → quote → transfer. And note it's transfer() here, sendTransaction() isn't supported in the gasfree module.

What's next

Follow WDK's official X account to stay up to date with all the announcements. Join us on Discord, the best place to ask questions, share what you're building, and get help directly from the team. All four modules are already documented and ready to use.

And after that, more to come. Protocol Integration: Swaps, Bridges, and Lending with WDK, where we layer DeFi functionality on top of these gasless wallets.

Gasless + swaps + bridges + lending = a complete DeFi experience without ever touching native tokens.

Receive the latest WDK news

Click to subscribe to the WDK newsletter and stay updated!