5

When executing my script files from a machine that needs to connect to a remote geth node, I get an "Invalid JSON RPC response: undefined" when using web3.personal.* functions.

In particular I have started geth in one workstation with the following parameters:

> geth --datadir /home/user/eth/ --networkid 123 --rpc --rpcapi "personal,web3,eth,net,db" --rpccorsdomain "*" console 2>>geth.log

Initially I tested the scripts by executing them locally, using the following HttpProvider:

Web3.providers.HttpProvider("http://localhost:8545")

The scripts are executed as expected and all the web3.personal.* functions such as web3.personal.listAccounts and web3.personal.unlockAccount() work well.

However when I execute the exact same script from a remote workstation and thus replace localhost with the IP of the machine running geth I get the following error:

Error: Invalid JSON RPC response: undefined

To be noted that I can execute other functions remotely, such as web3.version.api and web3.eth.contract(abiHEC), etc. So the problem seems to be the web3.personal.*.

I am using web3 version 0.20.6 and geth 1.8.2.

Do you have any suggestions on how to solve this?

Could it be that this is a security feature not allowing the use of personal functions remotely?

If so, do you have any recommendation on how I can invoke a smart contract function remotely? Thank you.

2
  • The keystore file must exist in the ethereum path. Are you sure those files exist on that remote system?
    – Rajesh
    Mar 21, 2018 at 11:52
  • There is a keystore directory under the --datadir used in the example above, i.e. /home/eth/keystore/. There is a file for each account I have created.
    – Ioannis
    Mar 21, 2018 at 14:44

1 Answer 1

1
geth --datadir ./myDataDir  --rpc --rpcapi db,eth,net,web3,personal --cache=2048  --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --networkid 1114 console 2>> myEth.log

Put the IP of your machine in --rpcaddr and try it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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