3

From the Web3 JS API I've written:

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/MYTOKEN"));
console.log(web3.currentProvider);

which produces:

HttpProvider {
  host: 'https://ropsten.infura.io/MYTOKEN',
  timeout: 0,
  connected: false }

So far I've tried removing the token and just using https://ropsten.infura.io, and I've also tried the Infura mainnet and Kovan, neither of which worked.

I suspect this is unrelated to Web3/Infura and maybe related to firewall settings or something? Any help is appreciated.

  • 1
    Did you try using the command line to send messages to eliminate firewall problems? $ curl -X POST \ -H "Content-Type: application/json" \ --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \ "mainnet.infura.io/YOUR_ACCESS_TOKEN" – larsl Jul 30 '17 at 22:06
  • 1
    have you issued correctly your infura token? – Badr Bellaj Jul 30 '17 at 23:12
  • Yes I correctly received my token and was able to get a response for $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' mainnet.infura.io/MYTOKEN – user16306 Jul 31 '17 at 0:16
  • This works for me...if this doesn't work for you, try shutting off your firewall (it never connects when mine is on) const Web3 = require("web3"); const web3 = new Web3(new Web3.providers.HttpProvider("ropsten.infura.io")); – thefett Jul 31 '17 at 1:14
  • I am having the same issue. Did you ever manage to work it out? – Jack Clancy Jan 16 '18 at 5:38
2

Switching to version 0.20.3 seemed to solve the issue for me. If you have version 1.0.0 that might be the source of the issue. Web sockets released by Infura seem to be working with version 1.0

Your Answer

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