I have used bitcoin-core package in node js to get the information about the block detail using rpc command.

For example:

var Client = require('bitcoin-core');

const client = new Client({ headers:'false', host:'', network:'testnet', password:'xxxx',port:'18332', ssl: {
    enabled: false,
    strict: false
  }, timeout:'3000', username:'xxxx' });

client.getBlockchainInformation().then((help) => console.log(help));

It throws below mentioned error:

unhandled rejection rpcerror: not found

Any solution for this.

Thanks in advance.

  • That code is trying to connect to a bitcoin testnet node RPC running locally ( port 18332). Do you have one running locally? – JBaczuk Sep 13 '18 at 14:49
  • Yes I have one running locally. – Sarath Kumar Sep 14 '18 at 2:27

The function client.getBlockchainInformation and the other methods exposed by the bitcoin-core npm module use bitcoin-core's REST interface. In order to use it, however, it must be enabled when you start bitcoind with the -rest flag.

The REST API can be enabled with the -rest option.

The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet, port 18332 for testnet, and port 18443 for regtest.


$ bitcoind -rest

or in bitcoin.conf

| improve this answer | |
  • Can you please suggest me how tether node is setup like a bitcoin. – Sarath Kumar Sep 14 '18 at 3:51
  • If it is unrelated to this post, please create a new question. – JBaczuk Sep 14 '18 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.