Can somebody tell me the right way to get info (decimals count, name and symbol) of the ERC-20 token from the Ethereum blockchain? I supposed that it could be done through the calls of the appropriate functions decimals(), name(), symbol() to the contract address of the exact token via ABI construction (if user web3js library). And in many cases it can be done such way. But unfortunatelly that's not for all cases. For example, there's a token with address: 0xb5a5f22694352c15b00323844ad545abb2b11028 If we read contract info about this token on etherscan's webpage, there's no any info written in the contract public variables name, symbol, and decimals: https://etherscan.io/address/0xb5a5f22694352c15b00323844ad545abb2b11028#readContract But etherscan knows the name and symbol of this token (ICON (ICX)). Moreover there's another website that can get info about decimals count for this token: https://api.ethplorer.io/getTokenInfo/0xb5a5f22694352c15b00323844ad545abb2b11028?apiKey=freekey So the question is: is there any universal way to get decimals, name and symbol for the exact token (e.g 0xb5a5f22694352c15b00323844ad545abb2b11028) via blockchain calls or not? And how etherscan and ethplorer.io website can handle such calculations? Hope somebody can help with my question. Thanks in advance!
Asked
Active
Viewed 5,321 times
1 Answers
0
The token provider interface spec says that those 3 methods are optional. It means that you can't expect every token contract to implement those. I guess that you have to have workarounds for those contracts which are not compatible with the standard.
For the https://etherscan.io/address/0xb5a5f22694352c15b00323844ad545abb2b11028#readContract if you look at the source code, the contract name is contract IcxToken
, that's at least one way to identify it.

battlmonstr
- 5,841
- 1
- 23
- 33
-
Thanks for your reply. Yes, I saw the standard for ERC20 tokens that says that decimals, name and symbol are optional. But the question is what method does ethplorer.io use to know this data. Ethplorer knows decimals, name and symbol for 0xb5a5f22694352c15b00323844ad545abb2b11028 token and I wonder how... – Alsofter May 09 '18 at 10:23