ERC-20 Tokens – How to See All Tokens Owned by an Account

erc-20tokens

Sorry, I do not understand this very well. But with tokens (let's say those which follow ERC20), can one ethereum address own multiple tokens? How would one determine the names and balances of those tokens using JSON RPC or web3?

Best Answer

can one ethereum address own multiple tokens?

Yes, any ethereum can own multiple tokens.

How would one determine the names and balances of those tokens using JSON RPC or web3?

You will need contract ABI and address of each contract to check balances. You can implement something like this:

var contarct1 = web3.eth.contract(contract1_abi).at(contract1_address);
var contarct2 = web3.eth.contract(contract2_abi).at(contract2_address);
var balance1 = contract1.balanceOf(accountAddr).toNumber();
var balance2 = contract2.balanceOf(accountAddr).toNumber(); 
Related Topic