0

I have a 2 node Ethereum system already setup. I am trying to have a web3 client talking to it. I installed web3 on a client machine and it gave no errors.

However, I try to setup index.js and do node web3. It gives me an error.

This is the error I see: Web3.providers.HttpProvider("http://172.17.0.5:8545") = web3; ^

TypeError: Cannot read property 'HttpProvider' of undefined

Basically, this means it is unable to pick up any of the web3 providers. I tried with WebSocketProvider and IPCProvider, but still see this issue.

any inputs on what the issue could be.

thx - Anand

  • If you share JavaScript code it will be helpful for us to understand your issue – Soham Lawar Sep 24 '18 at 12:05
  • I've not written any code yet. Just installed web3 and want to connect to a geth instance I have on another machine. – techieChamp Sep 24 '18 at 13:26
  • In the index.js file in the web3 folder, I wrote the following - – techieChamp Sep 24 '18 at 13:29
  • var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider("172.17.0.5:8545")); – techieChamp Sep 24 '18 at 13:29
  • Try to connect to ethereum node using metamask. – Soham Lawar Sep 24 '18 at 13:47
0

Add these parameters to your geth process:

--rpc 
--rpcapi web3,eth,personal,miner,net,txpool
--rpcaddr 172.17.WHATEVER

Note, that this is for tests only, and it is not a safe configuration, because the accounts are exposed

  • Didn't work. i in fact did a telnet from the client machine where web3 is installed to the geth node IP, port number (same as the IP/port I included in the index.js) and that worked. – techieChamp Sep 25 '18 at 6:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.