Crypto transfers cannot be reversed. If a user pastes the wrong address, or the right address on the wrong network, the money is usually gone. If your app takes a USDT address from a user, a few checks in the form catch most of these mistakes before anything is sent.
Two very different address formats
USDT exists on several networks, and their addresses look nothing alike:
-
TRON (TRC-20): starts with
T, 34 characters, base58 encoded, with a built-in checksum. -
EVM networks (Ethereum, BNB Smart Chain, Polygon): start with
0x, followed by 40 hexadecimal characters.
That difference is useful: a TRON address can never pass as an EVM address, and the other way round. So the first check is simply "does this address belong to the network the user picked?"
TRON: decode and verify the checksum
A TRON address is base58check: decode it and you get 25 bytes.
- The first byte must be
0x41, the TRON mainnet prefix. - The last 4 bytes are a checksum: the first 4 bytes of SHA-256 applied twice to the first 21 bytes.
- If the checksum does not match, the address has a typo.
The checksum is what makes this strong: change one character in a valid TRON address and the check almost always fails. Length and prefix checks alone would miss that.
EVM: format first, then the optional checksum
For 0x addresses the minimum check is the format: 0x plus exactly 40 hex characters.
On top of that, EIP-55 defines a checksum written into the letter case: in a mixed-case address, each letter is upper or lower case depending on the Keccak-256 hash of the lowercase address. So:
- an all-lowercase or all-uppercase address carries no checksum, and you can only check its format;
- a mixed-case address that fails EIP-55 contains a typo, so reject it.
The mistake no validator can catch
Ethereum, BNB Smart Chain and Polygon use the same address format. The same string is valid on all three, and often it is even the same wallet. So no code can tell whether a user meant BNB Smart Chain or Ethereum.
What helps instead:
- show the selected network prominently next to the address field;
- ask the user to confirm the network with a checkbox, enforced on the server, not just in the browser;
- store the network with the transaction, so support can see what was chosen.
Try it
I built a free checker that does all of the above in the browser: TRON base58 checksum validation, EVM format and EIP-55 checks, and a warning when the address belongs to a different network than the one selected: https://zikcards.com/tools/usdt-address-checker
If you are not sure which network to use in the first place, this short answer compares the fees and speed of each: https://zikcards.com/faq/which-network-should-i-send-usdt-on
I am the founder of ZikCards, which issues US Visa and Mastercard virtual cards funded with USDT or USDC. The checker is free and needs no sign-up.
Top comments (0)