Log in
Menu

How a TRON Transaction ID Is Calculated, and What the Signature Holds

A TRON txID is SHA-256 of raw_data, so it is known before sending. The 65-byte signature (r, s, v), signer recovery and a Node.js check on real transfers.

Category
Guides
Published
Reading time
7 min

A TRON transaction ID (txID) is the SHA-256 hash of the transaction’s raw_data bytes, the same bytes the API returns as raw_data_hex. Signatures sit outside raw_data, so the ID is fixed the moment the transaction is built and can be known, stored and shared before anything is sent. Each signature is 65 bytes, r, s and a recovery byte v, and from it anyone can recover the address that signed.

Below: what goes into the hash, why signing does not change it, how the signature is laid out, and a Node.js check we ran on three real USDT transfers from Nov 23, 2026.

What the txID is a hash of

A transaction has two parts that matter here: raw_data, everything the sender decided (reference block, expiration, the contract call, timestamp, fee limit), and the list of signatures. In java-tron, TransactionCapsule.getTransactionId() returns Sha256Hash.of(raw_data.toByteArray()) (TransactionCapsule.java), and sign() signs that same 32-byte value. The execution result, ret, is added by the network later and is not part of the ID either.

raw_data_hex is the protobuf encoding of raw_data, so the check needs no protobuf library: decode the hex to bytes and hash them. How expiration and the reference block limit a signed transaction is covered in can you cancel a USDT transaction; here only the bytes matter.

Our example is transfer 844f73bb…, a plain USDT transfer in block 88,246,423 (Nov 23, 2026, 05:57:06 UTC):

Item Value
raw_data_hex length 211 bytes
SHA-256 of those bytes 844f73bb03dedd01…9697c41145, equal to txID
Signatures 1, 65 bytes, last byte 01
Fee limit inside raw_data 30,000,000 SUN (30 TRX)
Receipt 64,285 energy, 345 bandwidth, SUCCESS

The hash TronScan shows as the transaction hash is this txID; reading the rest of that page is in tracking a USDT transaction on TronScan.

Why the ID is known before sending

Everything hashed is chosen before signing, so the ID exists before the network sees anything. We checked this with TronWeb 6.5.1 on Nov 23, 2026: we built a USDT transfer for a key generated locally (never funded, never broadcast), and the node answered with an unsigned transaction whose txID was 0493afe4…04614. After signing, the txID was the same.

Three consequences:

  • Signatures never move the ID. On a multi-signature account every co-signer signs the same 32 bytes, and adding the second or third signature leaves the txID as it was.
  • Any change to raw_data makes a new transaction. We raised the fee limit of transfer 844f73bb… by 1 SUN, from 30,000,000 to 30,000,001, by editing one byte of raw_data_hex. The hash became 0d07b57c63164077…, and the original signature no longer matched it.
  • Identical raw_data means an identical ID. Nodes refuse a transaction they already have (DUP_TRANSACTION_ERROR in java-tron’s api.proto). The optional timestamp field usually keeps two equal payments apart; one USDT transfer in block 88,246,423 was built without it.

This is also why a payout system can write the txID to its database before broadcasting and look it up later, instead of guessing from the recipient and the amount.

One more detail from TronWeb 6.5.1: trx.sign() rebuilds raw_data from the JSON fields, recomputes raw_data_hex and the txID, and refuses to sign if they disagree with what the node sent. If you sign hashes with other tools, do the same check: the signature covers the hash, not the JSON you looked at.

The signature: r, s and v

TRON signs with ECDSA on the secp256k1 curve, the same curve as Bitcoin and Ethereum, directly over the 32-byte txID with no prefix. The stored signature is 65 bytes:

Bytes Name Meaning
0 to 31 r First half of the ECDSA signature
32 to 63 s Second half
64 v Recovery byte: which of the possible public keys produced it

java-tron reads it in Rsv.java: bytes 0 to 32, 32 to 64, then byte 64, adding 27 if v is below 27. So 00/01 and 1b/1c (27/28) are the same thing written two ways. Of the 464 signatures in block 88,246,423, 333 ended in 00 or 01 and 130 in 1b or 1c. Encoders differ: java-tron’s own writes 0 or 1, TronWeb’s writes 27 or 28.

The last one was 68 bytes long. checkWeight only requires at least 65 bytes, Rsv ignores the rest, and Constant.java sets MAX_PER_SIGN_LENGTH to 68. The extra three bytes still count as transaction size: that transfer paid for 348 bandwidth instead of 345. Size and price of bandwidth are in TRON bandwidth cost.

Signing is deterministic in TronWeb: we signed the same txID twice with the same random key and got identical bytes.

Recovering who signed

From the txID and the signature the public key can be computed, and from the public key the address (the encoding is in TRON address validation). The network does exactly this in checkWeight: for each signature it recovers an address, looks up its weight in the permission the transaction uses, rejects unknown keys and keys that signed twice, and accepts the transaction when the weights reach the threshold.

Illustrative example; we ran it on Node.js 22.23.2 with TronWeb 6.5.1 (imported with createRequire from a local copy, otherwise unchanged):

// illustrative example: recompute a TRON txID and recover the signer (Node.js 18+, TronWeb 6.x)
import { createHash } from 'node:crypto';
import { TronWeb, utils } from 'tronweb';

const txid = process.argv[2];
const res = await fetch('https://api.trongrid.io/wallet/gettransactionbyid', {
  method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ value: txid }),
});
const tx = await res.json();

// 1. txID = SHA-256 of the raw_data bytes; signatures are not part of it
const raw = Buffer.from(tx.raw_data_hex, 'hex');
const id = createHash('sha256').update(raw).digest('hex');
console.log({ rawBytes: raw.length, txIdMatches: id === tx.txID });

// 2. Each signature is r (32 bytes) + s (32) + v (1); recover the key that made it
const owner = TronWeb.address.fromHex(tx.raw_data.contract[0].parameter.value.owner_address);
for (const sig of tx.signature) {
  const rsv = sig.slice(0, 130);                    // java-tron reads the first 65 bytes
  const v = parseInt(rsv.slice(128), 16);
  const signer = TronWeb.address.fromHex(utils.crypto.ecRecover(id, rsv));
  console.log({ bytes: sig.length / 2, v, signerIsOwner: signer === owner });
}

Results on Nov 23, 2026, all three from block 88,246,423:

Transaction txID matches Signatures v Signer
844f73bb… yes 1 × 65 bytes 1 the owner address
3b2f6053… yes 2 × 65 bytes 28, 27 two other keys, not the owner
46970de8… yes 1 × 68 bytes 1 the owner address

The second row is a multi-signature account. wallet/getaccount for its owner showed an owner permission with threshold 2 and three keys of weight 1; both recovered addresses are on that list, so 1 + 1 reached the threshold. The receipt fee was 7,840,500 SUN: 6,428,500 for energy, 412,000 for bandwidth (the second signature adds 67 bytes) and 1,000,000 for the extra signature (getMultiSignFee, explained with other keys in getchainparameters). How such permissions are set up is in TRON multisig permissions.

Checking a transaction yourself

  1. Fetch it by ID with wallet/gettransactionbyid (or take the unsigned transaction your code built).
  2. Hash raw_data_hex with SHA-256 and compare with txID. A mismatch means the JSON was altered or belongs to another transaction.
  3. Recover each signer from the txID and the first 65 bytes of each signature.
  4. Compare signers with the permission: the owner address for ordinary accounts, the keys and threshold from getaccount for multi-signature ones.
  5. Store the txID before broadcasting and use it as the reference for retries and status checks. Building and signing in code, step by step, is covered for USDT in our TronWeb guide; ordering energy from your own system is on the API page.

FAQ

Is the txID the same as the hash TronScan shows? Yes. TronScan’s transaction hash is the SHA-256 of raw_data, the same txID the API returns.

Can anyone change my transaction after I sign it? Not without breaking it. Any change to raw_data gives a new txID, and your signature does not match the new hash.

Why does my signature end in 1b or 1c and someone else’s in 00 or 01? Different encoders. java-tron adds 27 to values below 27 before recovery, so both forms verify the same way.

Does the txID depend on how many people sign? No. Signatures are outside raw_data, so the ID is the same with one signature or three.

Rent energy

UsdtPull sends energy to your address for a set period. The transfer goes through without burning TRX, your keys stay with you and the energy returns on its own afterwards.

Energy rentalUSDT TRC-20
  1. Address and period

    In the app, you enter your wallet address, the amount of energy and the rental period.

  2. Energy on your address

    Energy lands on your address. The delegation is visible in the block explorer.

  3. No TRX burned

    The transfer uses the rented energy instead of your TRX. When the period ends, the energy returns on its own.

Related posts

  1. Guides

    How to Check a USDT TRC-20 Balance via API: Three Ways Compared

    Read a USDT TRC-20 balance with balanceOf, the TronGrid account endpoint or the TronScan API. Real responses, unit conversion and a timed freshness test.

    8 min
  2. Guides

    How to Decode a USDT TRC-20 Transfer Event From Raw TRON Data

    Decode a USDT transfer on TRON: input data a9059cbb, the Transfer log from gettransactioninfobyid, TronGrid decoded events and a tested Node.js script.

    7 min
  3. Guides

    How to Check Energy and Bandwidth of an Address on TronScan

    Where TronScan shows energy and bandwidth, how to read Available X / Y, whether it covers a USDT transfer and who delegated the energy. With a real address.

    8 min