How to Know if an Address Is Blacklisted on TRON?
How to Know if an Address Is Blacklisted on TRON?
Usually when you trade Tether USDT on TRON blockchain, you will need to know if the target address is blacklisted. Because blacklisted address could NOT transfer USDT out unless it is removed from the Tether's black address list. And even more the USDT in blacklisted address has the possibility to be destroyed by Tether, once destroyed, the balance will be zero.
Then, how to know if an address is blacklisted? Following is the best way to check:
- open https://trx.tokenview.io/en/banned
- find the address you want to check
- if you cannot find the address from the list, then the address is not blacklisted
- if the address is listed, then the address is blacklisted
You might ask is this list correct? What's the logical behind the list? Well, below is the explanation from technical side.
Tether USDT on TRON is a token, a contract, it is running with codes on TVM. The codes are used by Tether USDT issuer to control the issue, redeem, transfer and blacklist.
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
Once Tether plans to add an address into blacklist, Tether will trigger "addBlackList" transaction from address MultiSigWallet, and put the target blacklisted address as the "Input parameter", then TVM will execute this code piece, and generate a AddedBlackList(index_topic_1address_user) event, this event could be retrieved from the log in the transaction information.
For example, transaction hash "b3b38075f9987af64f56c7059f9adb1dd4233de2af36d2d60bf45d9e30446bc9" is a "addBlacklist" transaction, it added address "TU4isedhHXquDQQvyK4CVGNRDWTvwqTpxR" into blacklist. Let's check its log information.
curl -H "Content-Type:application/json" -X POST http://<rpc node>/wallet/gettransactioninfobyid -d '{"value": "b3b38075f9987af64f56c7059f9adb1dd4233de2af36d2d60bf45d9e30446bc9"}'
{"id": "b3b38075f9987af64f56c7059f9adb1dd4233de2af36d2d60bf45d9e30446bc9","blockNumber": 57833080,"blockTimeStamp": 1704132882000,"contractResult": [""],"contract_address": "410fa695d6b065707cb4e0ef73b751c93347682bf2","receipt": {"energy_usage": 95895,"energy_usage_total": 95895,"net_usage": 313,"result": "SUCCESS","energy_penalty_total": 26102},"log": [{"address": "0fa695d6b065707cb4e0ef73b751c93347682bf2","topics": ["4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef","000000000000000000000000a89ae0805bbc6b0d7912d7103f216f3f2ff04f97","0000000000000000000000000000000000000000000000000000000000000419"]},{"address": "a614f803b6fd780986a42c78ec9c7f77e6ded13c","topics": ["42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc","000000000000000000000000c67d47af3dc61a89364f47bd00183c0700cf4ed3"]},{"address": "0fa695d6b065707cb4e0ef73b751c93347682bf2","topics": ["33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed75","0000000000000000000000000000000000000000000000000000000000000419"]}],"internal_transactions": [{"hash": "470c634e035dd06b02d06725e3d2302f914af5b523ca5d327bab727b39a30100","caller_address": "410fa695d6b065707cb4e0ef73b751c93347682bf2","transferTo_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c","callValueInfo": [{}],"note": "63616c6c"}]}
From the log, there is a topic "42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc", this is the "addBlackList" function, then we could parse the parameter of this topic, "000000000000000000000000c67d47af3dc61a89364f47bd00183c0700cf4ed3", yes, this is the targetted blacklisted address. It is the ETH formatted address, you will see "TU4isedhHXquDQQvyK4CVGNRDWTvwqTpxR" after changing the address format to be TRON format.
import base58
def base58Encode(hexStr):
ret = base58.b58encode_check(bytes.fromhex(hexStr))
if isinstance(ret,bytes):
ret = ret.decode()
return ret
ethAddress = log['topics'][1]
ethAddress = '41' + ethAddress[len(ethAddress)-40:]
tronAddress =base58Encode(ethAddress)
That's all. The list is from the on-chain data, you can verify them by yourself per your requests.
Tokenview is a blockchain data provider, all data are from chain, feel free to contact Tokenview to customize the data you want if you cannot find it from existing APIs.