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)
});
web3
in the console to check if it is successfully instantiated?