Decoding USDT TRC-20 Transfers on TRON: Trust the Log, Not the Input
Here is a USDT transaction from TRON block 88,160,500 (Nov 20, 2026). Its input data is a perfectly normal transfer call: selector a9059cbb, a recipient, and an amount of 0xc2459443c0, which is 834,391 USDT. If your indexer decodes the input and stops there, it records a large payment.
Nothing moved. The transaction is 90f6da29...1474, its result is OUT_OF_ENERGY, and its receipt has no event log at all. The only thing it consumed was 345 bandwidth on the sender's side.
That is the whole argument of this post in one example. The input is what someone asked for. The Transfer event in the receipt is what the USDT contract actually did. Below is how to read both, a small decoder with no dependencies, and a second real case where the input does not mention USDT at all, yet two USDT transfers happened.
Two records of one transfer
Every TRON transaction you care about here has two halves, and they come from different endpoints:
-
POST /wallet/gettransactionbyidreturns the signed transaction:raw_data.contract[0].parameter.valueholdsowner_address(the signer),contract_address(the contract being called) anddata(the ABI-encoded call).ret[0].contractRetcarries the result code. -
POST /wallet/gettransactioninfobyidreturns the receipt: block number, energy and bandwidth used,receipt.result, andlog, an array with one entry per event the contracts emitted.
Only the second one tells you whether tokens moved.
Reading the input by hand
Take a successful transfer from the same block: 6cfb8f53...b336, block time 06:19:51 UTC. Its data is 68 bytes:
a9059cbb selector: transfer(address,uint256) 00000000000000000000000095dca292f5d69fecd796ebfe31322d116e242172 recipient, left-padded to 32 bytes 00000000000000000000000000000000000000000000000000000000144f47a0 amount 0x144f47a0 is 340,740,000. USDT on TRON has 6 decimals, so that is 340.74 USDT. The recipient word ends in 20 meaningful bytes; put the TRON prefix byte 41 in front and Base58Check-encode it, and you get TPdbzdjNWqDLPUSfmfWVotDV3dRK5ZorjP.
Notice what the input does not contain: the sender. That is owner_address (410b35cb...3d2c), a sibling field. And the token is identified only by contract_address, 41a614f8...d13c, which is the hex form of the USDT contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t.
Reading the Transfer log
The receipt of the same transaction says result: SUCCESS, energy_usage_total: 64285, net_usage: 345, and has exactly one log entry:
| Field | Value | What it is |
|---|---|---|
address | a614f803b6fd780986a42c78ec9c7f77e6ded13c | the emitting contract, USDT, without 41 |
topics[0] | ddf252ad...523b3ef | Keccak-256 of Transfer(address,address,uint256) |
topics[1] | ...0b35cb995374111effd4be67be0c762cae883d2c | from, indexed |
topics[2] | ...95dca292f5d69fecd796ebfe31322d116e242172 | to, indexed |
data | ...144f47a0 | value: 340.74 USDT |
The split follows the event declaration Transfer(address indexed from, address indexed to, uint256 value): indexed parameters become topics, everything else is packed into data. The topic hash is the same one you know from ERC-20 on Ethereum, because TRON's virtual machine uses the same event encoding. Only the address format differs.
Two gotchas worth knowing before you write code:
- Node's
sha3-256is not Keccak-256. HashingTransfer(address,address,uint256)withcrypto.createHash('sha3-256')givesc17a9d92...07a1, notddf252ad.... Standard SHA-3 and Ethereum-style Keccak use different padding, and Node 22 ships only the former. Hard-code the topic or use a Keccak library. - The return value can lie, too.
contractResultfor this successful transfer is 32 zero bytes. The ABI saystransferreturnsbool, so a strict decoder readsfalse. The tokens moved anyway. Usereceipt.resultand the log; ignore the return value.
A decoder with zero dependencies
This runs on Node.js 18+ (we ran it on 22.23.2 against the public TronGrid node on Dec 2, 2026). It ignores the input completely and lists the USDT transfers that the receipt proves:
// Node 18+ built-ins only: list USDT TRC-20 transfers that actually happened in a transaction const { createHash } = require('node:crypto'); const NODE = 'https://api.trongrid.io'; const USDT = 'a614f803b6fd780986a42c78ec9c7f77e6ded13c'; // TR7NH...Lj6t, 20 bytes const TRANSFER = 'ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'; const B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; const sha256 = (buf) => createHash('sha256').update(buf).digest(); // 32-byte word (64 hex chars) -> T... address: keep the last 20 bytes, add 0x41, Base58Check function wordToAddress(word) { const payload = Buffer.from('41' + word.slice(-40), 'hex'); const bytes = Buffer.concat([payload, sha256(sha256(payload)).subarray(0, 4)]); let n = BigInt('0x' + bytes.toString('hex')); let out = ''; while (n > 0n) { out = B58[Number(n % 58n)] + out; n /= 58n; } return out; } // raw units (6 decimals) -> string, no floating point anywhere function formatUsdt(hex) { const units = BigInt('0x' + hex); return `${units / 1_000_000n}.${(units % 1_000_000n).toString().padStart(6, '0')}`; } async function call(path, txid) { const res = await fetch(NODE + path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ value: txid }), }); return res.json(); } async function usdtTransfers(txid) { const info = await call('/wallet/gettransactioninfobyid', txid); const result = info.receipt?.result ?? 'NOT_FOUND'; if (result !== 'SUCCESS') return { result, transfers: [] }; const transfers = (info.log ?? []) .map((entry, index) => ({ entry, index })) .filter(({ entry }) => entry.address === USDT && entry.topics?.[0] === TRANSFER) .map(({ entry, index }) => ({ key: `${txid}:${index}`, // dedup key: tx id + log index from: wordToAddress(entry.topics[1]), to: wordToAddress(entry.topics[2]), amount: formatUsdt(entry.data), })); return { result, transfers }; } usdtTransfers(process.argv[2]).then((r) => console.log(JSON.stringify(r, null, 2))); Output for the three transactions in this post (one call every few seconds; the public node rate-limits):
6cfb8f53... SUCCESS 1 transfer: TAzUsw...LsF7 -> TPdbzd...ZorjP 340.740000 90f6da29... OUT_OF_ENERGY 0 transfers 8f8240c1... SUCCESS 2 transfers: TC5tbs...dxg9n -> TLntW9...8ird 1.500000 TC5tbs...dxg9n -> TGhe1a...NpJ2m 12.000000 (The script prints JSON; it is condensed here for reading.) A few choices in it are deliberate:
- Amounts stay
BigIntuntil display. A JavaScriptnumberis exact only up to 2^53, which is about 9 billion USDT in 6-decimal units. That sounds like plenty until someone sums balances. - The filter checks the emitting contract, not just the topic. Any token contract, including a fake one named "USDT", can emit an event with the same
ddf252ad...topic. Onlyaddress === a614f8...d13cmakes it real USDT. - The key is
txid:logIndex. One transaction can carry several transfers, so the transaction ID alone is not unique.
The case where the input says nothing about USDT
Transaction 8f8240c1...a90d, same block, was signed by TFNX7T...XQNy and called a different contract, TFFAMQ...jF3U (hex 4139dd12...d510), with selector 6f21b898. An input-only parser that looks for a9059cbb on the USDT contract skips it.
The receipt holds three log entries. Two were emitted by the USDT contract, both from TC5tbs...dxg9n: 1.5 USDT and 12 USDT. The third came from the calling contract itself, with its own event signature fe6f7f85.... The whole thing used 154,896 energy and 701 bandwidth.
So the same filter rule cuts both ways: it drops the third entry, which is not a token transfer, and it catches the two real USDT movements that the input never mentioned. Payment routers and batch-payout contracts produce receipts like this all the time.
TronGrid's pre-decoded view
If you would rather not parse topics, TronGrid has GET /v1/transactions/{id}/events (reference). For 6cfb8f53... it returned on Dec 2, 2026:
{ "event_name": "Transfer", "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "event_index": 0, "result": { "from": "0x0b35cb995374111effd4be67be0c762cae883d2c", "to": "0x95dca292f5d69fecd796ebfe31322d116e242172", "value": "340740000" } } (trimmed). Three details trip people up: the contract is Base58 but from and to are 20-byte hex with 0x and no 41; value is a string in raw units; and items not yet in a confirmed block carry _unconfirmed: true. It is convenient, but it is an indexer's reading of the log. For crediting money, the raw receipt from a node is the primary source.
How to turn either of these into an incoming-payment pipeline (polling vs event streams, confirmation depth, the traps that credit money you never got) is covered in monitoring incoming USDT TRC-20.
Checklist
- Fetch the receipt with
gettransactioninfobyid. No receipt or anything butSUCCESSmeans nothing to credit. - Walk every entry in
log, not justlog[0]. - Keep entries where
addressis the USDT contract andtopics[0]is the Transfer topic. - Decode
fromandtofrom the last 40 hex characters oftopics[1]andtopics[2]: prefix41, Base58Check. - Parse
dataas a big integer; divide by 1,000,000 only when rendering. - Deduplicate on transaction ID plus log index.
What the receipt says about cost
The successful transfer above used 64,285 energy, and 49,635 of that was the dynamic-energy surcharge the network adds to busy contracts like USDT. A sender with no energy on the address pays for all of it by burning TRX at 100 SUN per unit, about 6.43 TRX for this one transfer, or roughly 13.1 TRX when the recipient holds no USDT yet. Renting 65,000 energy for an hour instead cost 1.17 TRX as of Dec 2, 2026 (18 SUN per unit); the rate changes. If your backend sends USDT as well as receiving it, energy can be ordered from code, see the energy rental API.
I work on UsdtPull, a TRON energy rental service, and this post is based on our blog article about decoding USDT transfer events.