I run:
geth --rinkeby --rpc --rpcport=8545 --rpcaddr=192.168.1.37
It works in console:
geth attach http://192.168.1.37:8545
> eth.syncing
false
> eth.accounts
["0xb4e4634e9eebb5a741b6c6beb7afb7746c09cbfc"]
Truffle migrate also works with
module.exports = {
networks: {
"geth": {
network_id: "*",
host: "192.168.1.37",
port: 8545
},
}
};
But when I run:
Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://192.168.1.37:8545"));
console.log(web3.currentProvider);
web3.eth.getAccounts().then(e => console.log(e));
I takes a couple of minutes and I get:
Error: Invalid JSON RPC response: ""
When I use --rpcaddress=localhost it works but of course only from localhost
I doesn't matter what version I use. Currently using:
geth: 1.9.6-stable
web3: 1.2.1
Truffle v5.0.38
Any ideas? Please!