nodejs bitcoin-cli command on RPC #25413

issue random9brat opened this issue on June 19, 2022
  1. random9brat commented at 6:42 AM on June 19, 2022: none

    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?

  2. MarcoFalke commented at 6:16 AM on June 20, 2022: member

    Any chances someone could help me make an outside of bitcoin-cli getblockcount request? What am I doing wrong?

    Are you sure that the call with bitcoin-cli works? If so, there is nothing we can do. Usually the issue tracker is used to track technical issues related to the Bitcoin Core code base. To get support for other software you'll have to ask them.

    General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange or the #bitcoin IRC channel on Libera Chat.

  3. MarcoFalke closed this on Jun 20, 2022

  4. DrahtBot locked this on Jun 20, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me