Log in
Menu

How to Validate a TRON Address: Format, Checksum and API Checks

A TRON address is 34 Base58Check characters starting with T. How to check it offline in Node.js, what validateaddress returns, and how to spot a contract.

Category
Guides
Published
Reading time
8 min

A TRON address is valid when it is 34 Base58 characters starting with T and decodes to 25 bytes: the prefix byte 0x41, a 20-byte account ID and a 4-byte checksum equal to the first 4 bytes of a double SHA-256 of the first 21 bytes. You can check this offline with Node.js built-ins or ask a node with wallet/validateaddress. A valid format still says nothing about whether the address is a contract or has ever been activated: for that you need wallet/getcontract and wallet/getaccount.

Below: the byte layout, a tested Node.js check, the answers TronGrid gave to six inputs, and what no validator can catch.

What a TRON address is made of

The accounts and keys page describes an address as a 21-byte value with a leading 0x41 byte. The 20 bytes after it are the last 20 bytes of the Keccak-256 hash of the public key. What users see is the Base58Check form of those bytes.

Part Size In the USDT contract address
Prefix 1 byte 41
Account ID 20 bytes a614f803b6fd780986a42c78ec9c7f77e6ded13c
Checksum 4 bytes first 4 bytes of SHA-256(SHA-256(the 21 bytes above))
Text form 34 characters TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Three practical consequences:

  • The first character is always T. With 0x41 in front, every valid address falls between T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb (an account ID of 20 zero bytes) and TZJozAg1ruapycCicgz31GxvYJ1FraLjZa (20 bytes of ff). We computed both ends ourselves. So the second character is always between 9 and Z as well.
  • The address is case-sensitive. Base58 uses digits 1 to 9 and Latin letters without 0, O, I and l, so T and t are different characters, and a lowercased address is simply invalid.
  • Hex and Base58 are the same address. Node APIs return 41... hex when visible is false; event logs and ABI-encoded parameters carry only the 20 bytes. The forms of the USDT contract specifically are listed in the USDT TRC-20 contract address guide.

Checking the format offline in Node.js

The checksum uses SHA-256, which Node.js has in node:crypto, so no package is needed. Illustrative example; we ran it on Node.js 22.23.2:

// illustrative example: offline format check of a TRON address, Node.js built-ins only
const { createHash } = require('node:crypto');

const ABC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
const sha256 = (b) => createHash('sha256').update(b).digest();

function decodeBase58(str) {
  let n = 0n;
  for (const ch of str) n = n * 58n + BigInt(ABC.indexOf(ch));
  const hex = n.toString(16).padStart(50, '0');      // 25 bytes = 50 hex characters
  return Buffer.from(hex, 'hex');
}

function checkTronAddress(addr) {
  if (!/^T[1-9A-HJ-NP-Za-km-z]{33}$/.test(addr)) return { ok: false, why: 'not "T" + 33 Base58 characters' };
  const raw = decodeBase58(addr);
  if (raw.length !== 25) return { ok: false, why: 'does not decode to 25 bytes' };
  const body = raw.subarray(0, 21);                   // 0x41 + 20-byte account id
  if (body[0] !== 0x41) return { ok: false, why: 'first byte is not 0x41' };
  const sum = sha256(sha256(body)).subarray(0, 4);    // checksum = first 4 bytes of double SHA-256
  if (!sum.equals(raw.subarray(21))) return { ok: false, why: 'checksum mismatch' };
  return { ok: true, hex: body.toString('hex') };
}

console.log(checkTronAddress('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'));
// { ok: true, hex: '41a614f803b6fd780986a42c78ec9c7f77e6ded13c' }

What it printed for six inputs:

Input Result
TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t, the USDT contract valid, hex 41a614f8...d13c
the same with the last t changed to T checksum mismatch
the same with the last character dropped not “T” + 33 Base58 characters
the same with 6 replaced by the letter O not “T” + 33 Base58 characters
T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb valid, hex 41 + 40 zeros
TRD3VPEy9qgLk4vkQgRP41vjKfwXn6t2fG, built from random bytes valid

The last row matters: anyone can build a correct address from random bytes, and nobody holds a key for this one. A valid checksum proves the string was copied without a typo, not that a person stands behind it.

How many typos the checksum catches

We took the USDT address and tried every single-character substitution from the Base58 alphabet in positions 2 to 34: 1,881 variants. All 1,881 failed, 1,847 on the checksum and 34 because the first byte was no longer 0x41. We also swapped every pair of neighbouring different characters: 32 variants, all rejected. A 4-byte checksum lets a random wrong string through about once in 4.3 billion tries, so a mistyped address in a form is almost always caught.

What wallet/validateaddress returns

If you prefer the node to decide, post the address to wallet/validateaddress. The reference says it detects the encoding itself and accepts Base58Check, 42-character hex starting with 41 and Base64. Our calls to the public TronGrid node, as of Nov 21, 2026:

Input result message
TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t true Base58check format
same, last t changed to T false Invalid address
41a614f803b6fd780986a42c78ec9c7f77e6ded13c true Hex string format
0xa614f803...d13c (Ethereum style) false Invalid address
a614f803...d13c (40 hex characters, no 41) false Length error
the USDT address in lowercase false Illegal character l at 22

Two notes from the reference: result: true means only that the format is correct, and message is only a hint that may be omitted. Check the boolean. Invalid input returns result: false with HTTP 200, not an error status.

Contract or regular address: getcontract and getaccount

Format is one question; what lives at the address is another. Two more read-only calls answer it. Illustrative example, check the exact format in the TRON documentation:

curl -s -X POST https://api.trongrid.io/wallet/getcontract \
  -H 'content-type: application/json' \
  -d '{"value":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","visible":true}'
curl -s -X POST https://api.trongrid.io/wallet/getaccount \
  -H 'content-type: application/json' \
  -d '{"address":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","visible":true}'

What came back, as of Nov 21, 2026:

Address getcontract getaccount Meaning
TR7NHq…Lj6t ABI, bytecode, name TetherToken, origin_address THPvaU…n5YC "type": "Contract", account_name TetherToken a smart contract
T9yD14…uWwb {} no type field, balance 773,803 TRX, created Dec 30, 2018 a regular, activated account
TRD3VP…t2fG (random bytes) not asked {} valid format, never activated

Reading the answers:

  • getcontract returns {} for anything that is not a contract, including valid regular addresses. A filled object with bytecode and abi means code lives there.
  • getaccount alone also tells a contract apart: contracts carry "type": "Contract"; regular accounts omit the field, because the default value is not printed.
  • getaccount returning {} means the address does not exist on chain yet. The accounts page says the network recognizes an address only after activation. Such an address can still receive TRX, and the sender then pays the creation fee; details are in how to activate a TRON address.

What validation does not catch

  • A look-alike address. A scammer’s address that shares the first and last characters with yours is perfectly valid and passes all three calls. Compare the whole string with a trusted source. The scheme is described in address poisoning on TRON.
  • The wrong destination type. A token contract address is valid, so a validator will not stop a user who pastes TR7NH...Lj6t as the recipient of a USDT transfer. If your form expects a person’s wallet, reject addresses where getaccount shows "type": "Contract", unless you know the contract is meant to receive.
  • A key nobody controls. As the random-bytes row shows, a valid address can have no owner. Funds sent there cannot be moved.
  • An address from another network. A 0x... string fails validateaddress. If a system converts EVM hex to TRON hex by adding 41, the result is a valid TRON address, but on a different chain than the user meant. Do not convert addresses for users.

A validation routine for a payout form

  1. Trim spaces and line breaks; do not change letter case.
  2. Check the format offline with the function above, or with validateaddress and its result field.
  3. Store the hex form next to the Base58 one: you will need it to match logs and ABI parameters.
  4. Call getaccount. {} means not activated: warn the user and show the activation cost. "type": "Contract" means a contract: block or ask for confirmation.
  5. Show the full address back before sending, not a shortened one, so the user compares every character.

If your service sends USDT from these addresses, the next question is energy; the API page and our FAQ cover how to request it from your own code.

FAQ

Is a TRON address case-sensitive? Yes. Base58 treats upper and lower case as different characters, so changing the case of one letter almost always breaks the checksum.

Does wallet/validateaddress check that the address exists? No. The reference says it validates the format only and does not check activation. Use getaccount: {} means the address is not on chain yet.

Can I convert hex to Base58 without TronWeb? Yes. Append the first 4 bytes of a double SHA-256 of the 21 bytes and encode the 25 bytes in Base58; it is the reverse of the function above. If you already use TronWeb, the JavaScript library can convert too; check the exact function in the TronWeb documentation.

Do these API calls cost energy or TRX? No. They read node data and do not create transactions.

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

    Address Poisoning on TRON: How Look-Alike USDT Addresses Trick You

    How address poisoning works on TRON: look-alike addresses, dust TRX and tiny USDT gifts, real cases from the chain, the math behind them and how to stay safe.

    8 min
  2. Guides

    What Is USDT TRC-20? Tether on the TRON Network Explained

    USDT TRC-20 is Tether's dollar token issued as a smart contract on TRON. Address, decimals, supply, minting and blacklist, read from the chain on Nov 2, 2026.

    8 min
  3. Guides

    How to Activate a TRON Address and What It Costs

    A new TRON address works only after an incoming TRX transfer. The sender pays 1.1 TRX. Why USDT does not activate it and what to do before renting energy.

    7 min