Hey guys,
I just installed my first full node on no ubuntu without gui, I opened all the ports, node is fully working and i got bitcoin,conf like this:
rpcuser=xxx rpcpassword=xxx rpcport=8332 rpcallowip=0.0.0.0 server=1 daemon=1
So i installed nodejs and made this script in nodejs index.js file:
console.log("something"); const Client = require('bitcoin-core'); const wallet1 = new Client({ host: 'xx.xxx.xx.xx', port: '8332', username:'xxx', password: 'xxx'
}); wallet1.command('getblockcount').then((responses) => console.log(responses));
console.log("something2");
when i try to run it it sends me this error:
(node:22608) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT xx.xxx.xx.xxx:8332
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(Use node --trace-warnings ... to show where the warning was created)
(node:22608) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:22608) [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.
Any chances someone could help me make an outside of bitcoin-cli getblockcount request? What am I doing wrong?