I was trying to connect to my node via IPC using web3_ipc
. But i got hit by:
You tried to send "eth_getBalance" synchronously. Synchronous requests are not supported by the IPC provider.
My code is as:
var web3_extended = require('web3_ipc');
var path = require('path');
var absolutePath = path.relative('./','/home/pr.singh/.ethereum/geth.ipc');
var options = {
host : absolutePath,
// host: 'http://10.10.23.139:8013',
ipc : true,
personal: true,
admin: true,
debug: false
};
var web3 = web3_extended.create(options);
exports.checkBalance = function(req, res) {
var bal = req.body.balance;
var accountBalance=web3.eth.getBalance(bal).toNumber();
console.log(accountBalance);
}
If I connect using rpc, everything works good but while connecting via IPC , I am getting error. Any help?