0x5a65585ce8213d1c9433e63d53d4e468540a5019 is my CRC20 token. I can search the token info on etherscan. https://ropsten.etherscan.io/token-search
Token Attributes Found: totalSupply = 100 name = ZONO symbol = ZONO decimals = 0
How can I do it without etherscan? I have my own geth server. Is it possible to get from my geth server? Are there any good libralies?
I guess I can use eth_call. I know how to get balance of an address like below. I need to know the hex of totalSupply, name, symbol, and decimals.
var balanceHex = "0x70a08231"; // I believe this is the hex for balance var contractAddress = "0x5a65585ce8213d1c9433e63d53d4e468540a5019"; var userAddress = "0x5DBB9793537515398A1176d365b636A5321D9e39"; var balanceCall = getDataObj(contractAddress, balanceHex, [getNakedAddress(userAddress)]); var balance = web3.eth.call(balanceCall);
I think the following is fine.
var totalSupply = web3.sha3('totalSupply()').substring(0,10); console.log(totalSupply); // 0x18160ddd