I want to be able to interact with functions on a smart contract. I do not want to setup my own node using geth, and would like to use something like Infura as a remote node.
Based on what I have seen, one of the more popular options is Web3, but I cannot get it connect to my Infura node. I run the below commands (after opening the NodeJs console using "node"):
Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/personalcode"));
Running web3.eth.blockNumber after doing this returns null though. I also see the below in the output after running the require statement:
HttpProvider
host: 'https://mainnet.infura.io/personalcode',
timeout: 0,
connected: false,
The Web3 version is 1.0.0-beta.34 btw (not sure if that has anything to do with it).
Any suggestions or pointers on what I am doing wrong? I am not committed to using web3 btw. Any way to interact using the command line is fine.