I'm trying to use Web3 1.0 to call the balanceOf function on my contract. The error I get during runtime is as follows: Error: Provider not set or invalid.

The code causing the problem is as follows:

var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/XKEYX'));

Has anyone seen this and knows what I can do to overcome it?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.