data = web3.utils.sha3('balanceOf(address1)').slice(0,10) + randomstring.generate({ length:24, charset:'0'}) + address1.substring(2);

web3.eth.call({to : config.ContractAddress, data : data}).then((result) =>{ console.log("bbbbbbbbb", result);}).catch((e) =>{ console.log("eeeeeeeeeee" , e); });

  • i am using this contract function to find the balance of token but every time it reurn 0x . i dont know what is going wrong . i want to learn more about how to set data field to calculate the token balance
    – rahul_eth
    Mar 10, 2018 at 13:25
  • In your sha3 expression try 'balanceOf(address)' (i.e. omit the 1) - this should give you the correct ABI. Mar 11, 2018 at 6:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.