2

I cant connect my nodejs console to my geth node via ipc. I'm doing something wrong but cant figure it out. Also I cant find my ipc files anywhere.

Using geth v1.6.6

I start my private network default geth node and see the IPC path as below.

INFO [08-18|10:01:49] IPC endpoint opened: \\.\pipe\geth.ipc 

this is from another node. The path to the ipc doesn't even exist. Do I have to create it manually?

INFO [08-18|10:13:41] IPC endpoint opened: \\.\pipe\C:\Users\myuser/Library/Ethereum/mynode1/geth.ipc 

I start the nodejs console and type the following;

var web3=require('ethereum.js')
var client = require('net')
web3.setProvider(new web3.providers.IpcProvider('ipc:.geth.ipc', client);

All I get is ....

Below works fine for RPC

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

The path C:\Users\myuser\AppData\Roaming\Ethereum is empty

mechanicum
  • 311
  • 3
  • 14

2 Answers2

1

You're missing a bracket after client), hence, ..., waiting for user input.

web3.setProvider(new web3.providers.IpcProvider('ipc:.geth.ipc', client);

should be

web3.setProvider(new web3.providers.IpcProvider('ipc:.geth.ipc', client));
0

This works for me in Windows and web3 v0.20

const Web3 = require('web3');
const net = require('net');

const client = net.Socket();
const ipcNode = '\\\\.\\pipe\\geth.ipc';

const web3 = new Web3(new Web3.providers.IpcProvider(ipcNode, client));
Ismael
  • 30,570
  • 21
  • 53
  • 96