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

10
  • If you share JavaScript code it will be helpful for us to understand your issue Commented Sep 24, 2018 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.
    – Omi
    Commented Sep 24, 2018 at 13:26
  • In the index.js file in the web3 folder, I wrote the following -
    – Omi
    Commented Sep 24, 2018 at 13:29
  • var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider("172.17.0.5:8545"));
    – Omi
    Commented Sep 24, 2018 at 13:29
  • Try to connect to ethereum node using metamask. Commented Sep 24, 2018 at 13:47

1 Answer 1

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

1
  • 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.
    – Omi
    Commented Sep 25, 2018 at 6:24

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.