7

I have successfully run geth --rpc to test some functionality, but I need the personal API which according to this answer should be done by IPC.

When I run

geth --ipcapi "db,eth,net,web3,personal" --ipcpath /tmp/geth.ipc

This creates the ipc file and geth appears to otherwise start normally.

I have the following npm modules installed: web3 web3_extended web3_ipc

Then I run this on nodejs:

var web3_extended = require('web3_extended');

var options =
{
    host:     '/tmp/geth.ipc',
    ipc:      true,
    personal: true, 
    admin:    false,
    debug:    false
};

var web3 = web3_extended .create (options);

var coinbase = web3.eth.coinbase;

The last line gives me an HTML response which includes

Your browser sent a request that this server could not understand.

and

Apache/2.4.12 (Ubuntu) Server at localhost Port 80

That Apache line makes me think nodejs isn't even attempting to connect by IPC.

Why not? Or, what else is the problem?

spraff
  • 645
  • 1
  • 10
  • 22

1 Answers1

3

Summary

Q: Why can't I connect by IPC? Why not? Or, what else is the problem?

A: From your HTML response message, it seems like your code is currently using the version of web3_extended that does not support the IPC protocol.



Details

Can you check that you are using tjade273/web3_extended and NOT The18thWarrior/web3_extended?

The first was forked from the second, and includes the IPC protocol handling. From tjade273/web3_extended/blob/index.js - lines 7 to 15:

function create(options) {
    if(options.ipc){
        var client = new net.Socket();
        web3.setProvider(new web3.providers.IpcProvider(options.host,client));
    }
    else{
        web3.setProvider(new web3.providers.HttpProvider(options.host));
    }
    if (options.personal) {

while the original code from The18thWarrior/web3_extended/blob/index.js - lines 6 to 9:

function create(options) {
    web3.setProvider(new web3.providers.HttpProvider(options.host));

    if (options.personal) {
BokkyPooBah
  • 40,274
  • 14
  • 123
  • 193
  • Thanks! That looks like the reason. Aside from pulling files down manually, is there a way I can set up npm/ubuntu to obtain the right version? – spraff Apr 27 '16 at 00:15
  • @spraff You can use npm install web3_ipc to install mine as opposed to web3_extended for the other version – Tjaden Hess Apr 27 '16 at 00:58
  • I also have same issue, but i didn't get the proper solution. Do i need to install only web3_ipc and not web3_extended? As in this case I am getting error cannot find node module web3_extended. And If install both node modules web3_extended and web3_ipc , I get same error as Your browser sent a request that this server could not understand. Please help! – Prashant Prabhakar Singh Dec 16 '16 at 05:56