My below code is working fine

Web3 = Require('web3');
const walletAddress = '0x8690F1feff62008A396B31c2C3f380bD0Ca6d8b8';
const web3 = new Web3(new Web3.providers.HttpProvider(testnet));
var balance = web3.eth.getBalance(walletAddress); //Will give value in.
balance = web3.toDecimal(balance);

But when I run:


It throws an error:

"TypeError: Cannot read property 'fromWei' of undefined"

I am using Web3 0.19.1 and node 10.15.1.

1 Answer 1


With web3.js v0.x, use web3.fromWei.

With web3.js v1.x, use web3.utils.fromWei.

  • Hi,Thats working fine..Thnx for the quick reply Commented Feb 26, 2019 at 15:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.