I am trying to read the token balance of a certain address as well as reading the amount of ETH that has been sent to a smart contract from that address.

Currently I have:

var web3 = new Web3(new 

abi = JSON.parse('[{"constant":true,"inputs": 
TokenContract = web3.eth.contract(abi);

contractInstance = TokenContract.at('[TOKEN CONTRACT ADDRESS]');
var balance = contractInstance.balanceOf(userAddress);

The abi is a standard ERC20 abi, but balanceOf returns an object (r {s: 1, e: 0, c: Array(1)}), shouldn't it return an integer? How should I get the token balance from this?

1 Answer 1


The result value is a bignumber. You can just use toString to get value.


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.