1

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 as per https://i.imgur.com/CW7InGp.png. What's going on? What am I doing wrong?

Error: The method eth_newFilter does not exist/is not available

  • 1
    "And I get a whole load of errors." Maybe tell us what those errors are. :-) – user19510 Jun 12 '19 at 17:25
  • good point :) updated my Q with the errors. I think it's the same set of errors when I use localhost when parity isn't running. It just can't connect to a node. – pumpkinfeet Jun 12 '19 at 19:24
  • are you listening for events using websockets? – AnAllergyToAnalogy Jun 12 '19 at 19:31
  • 1
    Possible duplicate of Infura web3 provider for Events (.get & .watch) – Ismael Jun 12 '19 at 19:48
  • 1
    @pumpkinfeet Infura only support events through websockets. – Ismael Jun 12 '19 at 19:49

Browse other questions tagged or ask your own question.