2

From this, i found that

To add a token to watch, go to the contracts page and then click "Watch Token". A pop-up will appear and you only need to paste the contract address. The token name, symbol and decimal number should be automatically filled.

How can i perform same thing in case of testnet. I mean how will a testnet user will see the tokens he possess.I am using GETH client and web3 to interact with node and pass related data to UI .

1

From your question, you don't want to use the Ethereum Wallet to add the Watch Token function. Instead you want to use geth JavaScript to find the token balance.

If this is the case, you can use the same type of script as in Script To Get Account Balances And Including TheDAO Tokens.

Your code would look like the following:

var tokenContractABI = {your token contract ABI};
var tokenContractAddress = "{your token contract address}";
var tokenContract = eth.contract(tokenContractABI).at(tokenContractAddress);
var tokens = tokenContract.balanceOf({user address});
console.log(tokens);
7
  • Here : ethereum.org/token, they provide an UI page to execute the token contract but in geth private blockchain , we use eth.getbalance(address) to see the balance.It just shows ether. So how can user check the tokens like that?
    – Aniket
    Aug 23 '16 at 8:09
  • What operating system are you running? The reason why I'm asking is because you can run geth on a private network and connect the Ethereum Wallet to geth and EW will be your UI. See the answer to ethereum.stackexchange.com/questions/5716/… .
    – MELVIS.ETH
    Aug 23 '16 at 8:24
  • I saw your message about Windows, but it has disappeared. Check out ethereum.stackexchange.com/a/4421/1268 . Message back if it does not work.
    – MELVIS.ETH
    Aug 25 '16 at 7:22
  • yeah, i saw the same after comment and then i deleted comment. I am trying to solve my purpose. In case of problem, i will be back to you.:)
    – Aniket
    Aug 25 '16 at 7:26
  • 1
    I am running one geth instance in which i have created two accounts.I don't know what was the problem. I closed the geth instance and ran again now it is working fine.Thanks.
    – Aniket
    Aug 26 '16 at 6:34

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.