1

I ran the below command, which I understood should've connected me to the mainnet:

curl -X POST \ -H "Content-Type: application/json" \ --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \ "mainnet.infura.io/my-token

but there appears to continue to be some issue.

  • Any idea why?
  • Have I made some syntax error, or am I supposed to be swapping out an actual block number for eth_blockNumber, or similar?

To make sure it's clear that I didn't make the following mistake, I did swap out 'my-token' for the 20 digit token Infura generated for me.

Thanks so much!

2
  • What type of issue do you face? Can you add some error code? Commented Mar 5, 2018 at 19:14
  • Hi Roman - Thanks for the response. Yes! When I attempt to run a script that I need to get working today, I get the following: Error: CONNECTION ERROR: Couldn't connect to node mainnet.infura.io. at Object.InvalidConnection (/home/ubuntu/server/node_modules/web3/lib/web3/errors.js:31:16) at HttpProvider.send (/home/ubuntu/server/node_modules/web3/lib/web3/httpprovider.js:87:18) at RequestManager.send (/home/ubuntu/server/node_modules/web3/lib/web3/requestmanager.js:58:32) at Eth.send [as getBalance] ....etc.
    – Rachel
    Commented Mar 5, 2018 at 19:22

1 Answer 1

3

Make sure to use HTTPS. This works:

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' https://mainnet.infura.io/my-token
0

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.