web3js – The Web3 script running under node.js is never closed with Web3.providers.IpcProvider
This script print account list, but never closed with Web3.providers.IpcProvider
var Web3 = require('web3')
const net = require('net');
var web3 = new Web3(new Web3.providers.IpcProvider("/home/frolov/node1/geth.ipc", net));
web3.eth.getAccounts().then( accounts => {console.log(accounts)} )
But when using Web3.providers.HttpProvider, script run and closed normally:
var Web3 = require('web3')
const net = require('net');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.getAccounts().then( accounts => {console.log(accounts); } )
Why it happens??
Read more here: Source link