| Did you know ... | Search Documentation: |
| Pack usdt_network -- README.md |
You copy a USDT deposit address, pick a network in your wallet and press send. If the address is a TRON address and you picked Ethereum, the wallet usually refuses. If you picked BNB Smart Chain and the address is a `0x` address that the receiver only watches on Ethereum, the wallet happily sends it and the money sits somewhere nobody is looking.
This pack does the boring check before you press send. It runs offline and never talks to a node.
?- pack_install(usdt_network).
?- use_module(library(usdt_network)).
?- address_networks("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", Ns).
Ns = [tron, solana]. % 34-char Base58 starting with T
?- address_check("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", tron, S).
S = checksum_ok.
?- address_check("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6u", tron, S).
S = checksum_bad. % one character changed
?- send_check(ethereum, "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", V).
V = mismatch([tron, solana]).
?- send_check(polygon, "0xdAC17F958D2ee523a2206206994597C13D831ec7", V).
V = ambiguous_evm([ethereum, bnb_smart_chain, polygon, arbitrum,
optimism, base, avalanche_c]).
?- network_info(tron, Standard, Gas).
Standard = 'TRC-20', Gas = 'TRX'.
| Format | Networks | Checksum verified |
|---|---|---|
| T + 33 Base58 chars | TRON (TRC-20) | yes, Base58Check |
| `0x` + 40 hex | Ethereum, BNB Smart Chain, Polygon, Arbitrum, Optimism, Base, Avalanche C-Chain | no (EIP-55 needs Keccak-256) |
`1... / 3...` Base58 | Bitcoin legacy / P2SH | yes, Base58Check |
| `bc1q...` | Bitcoin SegWit v0 | yes, Bech32 |
| `bc1p...` | Bitcoin Taproot | yes, Bech32m |
| 32-44 Base58 chars | Solana (SPL) | no checksum in the format |
| EQ / UQ + 46 chars | TON | not verified |
| `lnbc...` | Lightning invoice | not verified |
ambiguous_evm and you
should ask, or read the deposit page again.We run CryptoeSIM.io, a travel eSIM shop where you pay in BTC, ETH or USDT on TRC-20 or ERC-20. Our own checkout page says it plainly: wrong-network sends are the one thing we cannot always recover. So before you buy an eSIM with crypto, from us or from anyone else, run the deposit address through this first.
swipl -g run_tests -t halt test/test_usdt_network.pl
The tests use public, well-known addresses only: the USDT contract on TRON and Ethereum, the Bitcoin genesis address and the BIP-173 / BIP-350 vectors.
MIT licence.