I have a geth instance running on a server and I'd like to be able to interact with it from other machines. I tried a lot of things but they cant connect.

How do you proceed to, lets say being able to act on that node from an external source?

Tried: In console:

geth attach http://remote_ip:8545

geth attach --rpcaddr remote_ip --rpcport 8545

In a webpage with web3:

web3.setProvider(new web3.providers.HttpProvider("http://remote_ip:8545"));

  • Please add what you tried, so we can help you better. There are more than one way to skin a cat. – Herman Junge Feb 23 '17 at 14:18

OK, let's see one by one

geth attach http://remote_ip:8545

Won't work: as geth attach accepts as a parameter an ipc entry (this is just a unix socket). There is a way to expose sockets remotely using socat. I'll leave it as an exercise to the reader to find it.

web3.setProvider(new web3.providers.HttpProvider("http://remote_ip:8545"));

This one, connects with the remote RPC (not the same as the IPC). You need to expose your RPC while launching geth, with the options

--rpc --rpcport "8545" --rpcaddr "" --rpccorsdomain "*"

SECURITY WARNING: Exposing both IPC or RPC conveys a security risk, as anybody able to find your machine, will have access. There is no built-in authentication inside geth.


I encourage you to adopt a more secure approach: Use SSH and attach this way

ssh -i <your private SSL key filepath> user@remote_ip "geth attach ipc:///<path to datadir>/geth.ipc"

Will open you an ssh tunnel to operate with the console. This is as secure and encrypted as it can be.

  • Do you think I could do the SSh approach for mobiles phones users? – Rémi Vouliot Feb 23 '17 at 14:42
  • 3
    If you find the right libraries to do the connections, why not? Be advised, anyways that you will need to distribute the private key or a user, password of your site. If you want to use a professional maintained synchronized RPC node of mainnet or ropsten, you could use INFURA instead (disclaimer, I am the founder) -> infura.io – Herman Junge Feb 23 '17 at 16:03

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.