5

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?


Update 1

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);

Update 2

I think the following is fine.

var totalSupply = web3.sha3('totalSupply()').substring(0,10);
console.log(totalSupply); // 0x18160ddd

How can I retrieve my account's Augur (REP) token balance via JSON-RPC?

5

I found it.

var totalSupplyHex = web3.sha3('totalSupply()').substring(0,10);
var contractAddress = "0x5a65585ce8213d1c9433e63d53d4e468540a5019";
var totalSupplyCall = getDataObj(contractAddress, totalSupplyHex, []);
var totalSupply = web3.eth.call(totalSupplyCall);
console.log(totalSupply); // 0x0000000000000000000000000000000000000000000000000000000000000064

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.