10

This this the command line i have used to get geth running.

geth ipc --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --ipcpath "/root/.ethereum_experiment/geth.ipc"

so from node js how to connect to this geth client, before this i was doing rpc and connected using http providers but i want the connection over IPC not over RPC.

2 Answers 2

6

according to the documentation you can do:

$ geth attach ipc:/some/custom/path
$ geth attach http://191.168.1.1:8545
$ geth attach ws://191.168.1.1:8546

So the 1st line is what you want, just replace /some/custom/path with /root/.ethereum_experiment/geth.ipc

edit : just saw you want to do it on nodejs, I didn't test it but using the provider with ipc:/some/custom/path should be ok

5

Since you asked specifically about Node.js, see my answer to the similar question Getting contract balance over JSON RPC

TL;DR use the official web3 JavaScript library which handles connecting to the server over RPC and gives you easy access to query it for data.

See the question I linked for more details.

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.