The output you receive is in hex format. You need to conver hex to an int. Here is the full code you need to use: const contractInstance = web3.eth.contract(contractAbi).at(contractAddress); const total_supply = parseInt(contractInstance.totalSupply.getData()); console.log(total_supply); I added parseInt() to convert your hex number into a human readable ...


In web3.js v0.x: The expression contractInstance.totalSupply.getData() would get you the encoded ABI data (byte-code) of a call to function totalSupply. In order to actually call the function and retrieve the return-value asynchronously, you should use: contractInstance.totalSupply.call().then(total_supply => { console.log(total_supply); }); In ...


Change it to this: async function run() { const decimals = await contract.methods.decimals().call(); for (var i = 0; i < 8444182; i++) { const balance = await contract.methods.balanceOf(address).call(null, i); const actual = new BigNumber(balance + "e-" + decimals); console.log(actual.toFixed()); } } run();

Only top voted, non community-wiki answers of a minimum length are eligible