1

Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '/home/sanya/.ethereum/geth.ipc' } (node:3593) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)

(node:3593) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:3593) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Code for deployment is -

const solc = require('solc');

const net = require('net');

let fs = require("fs");

let Web3 = require('web3');

const web3 = new Web3('/home/sanya/.ethereum/geth.ipc', net, {});

let source = fs.readFileSync('../ethereum/node01/contracts/KYC.sol');

console.log(source.toString());

let helloCompiled = solc.compile(source.toString(), 1).contracts[':KYC'];

var password = "apple";

try {
    web3.eth.personal.unlockAccount("0x49f513854af455f45044b12869ebb1dec9db3073", password, 600)

}

catch (e) {

    console.log(e);

    return;
}

let Hello = new web3.eth.Contract(JSON.parse(helloCompiled.interface),

    null, {

    data: '0x' + helloCompiled.bytecode

});

console.log("abi" + helloCompiled.interface)

console.log("abi" + typeof (helloCompiled.interface))

console.log("bin" + helloCompiled.bytecode)

console.log("bin" + typeof (helloCompiled.bytecode))

let helloInstance;

Hello.deploy().send({

    from: '0x49f513854af455f45044b12869ebb1dec9db3073',

    gas: '4700000'

}).then((instance) => {

    console.log("Contract mined at " + instance.options.address);

    helloInstance = instance;


})

    .catch(function (error) {

        console.log(error)

    });
1
  • 1
    can you log web3 in the console to check if it is successfully instantiated?
    – Yahya
    Nov 14, 2019 at 13:14

2 Answers 2

1

I changed the path and it worked

locate geth.ipc

/opt/project/ethereum/geth.ipc

0

It looks like there's a problem with your geth instance. Make sure it has the latest version of the blockchain download it, restart it again and let us know if you still have the error. If it doesn't, I'd recommend you to use infura for deploying your contract because you don't have to manage your own node.

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.