Trying and failing to switch my dapp from local node to infura, please help?

by pumpkinfeet   Last Updated June 12, 2019 15:28 PM

I have a nodejs 'server' running that listens for events on the blockchain. Currently I have this line in my code:

var provider = new Web3.providers.HttpProvider("http://localhost:8545");

But I'm fed up paying $40 every month for my node. I want to switch to infura. I signed up, added my project, got project ID. Then changed this line of code to:

var provider = new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/PROJECTID");

And I get a whole load of errors. What's going on? What am I doing wrong?

Tags : nodejs infura


Related Questions


Updated September 26, 2017 01:28 AM

Updated December 09, 2017 05:28 AM

Updated March 30, 2018 20:28 PM

Updated October 08, 2018 11:28 AM

Updated October 18, 2018 12:28 PM