<p>The function <code>client.getBlockchainInformation</code> and the other methods exposed by the <code>bitcoin-core</code> <code>npm</code> module use <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md" rel="nofollow noreferrer">bitcoin-core's REST interface.</a> In order to use it, however, it must be enabled when you start <code>bitcoind</code> with the <code>-rest</code> flag.</p>

<blockquote>
  <p>The REST API can be enabled with the -rest option.</p>
  
  <p>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.</p>
</blockquote>

<p><strong>e.g.</strong>:</p>

<p><code>$ bitcoind -rest</code></p>

<p>or in <strong>bitcoin.conf</strong></p>

<pre><code>rest=1
</code></pre>

CC BY-SA 4.0
2018-09-14T03:51:21.450Z
Can you please suggest me how tether node is setup like a bitcoin.
Sarath Kumar
CC BY-SA 4.0
2018-09-14T04:02:46.153Z
If it is unrelated to this post, please create a new question.
JBaczuk
CC BY-SA 4.0
2018-09-14T03:05:57.463Z
2018-09-14T03:05:57.463Z
JBaczuk
<p>I have used bitcoin-core package in node js to get the information about the block detail using rpc command. </p>

<p>For example:</p>

<pre><code>var Client = require('bitcoin-core');

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

client.getBlockchainInformation().then((help) =&gt; console.log(help));
</code></pre>

<p>It throws below mentioned error:</p>

<pre><code>unhandled rejection rpcerror: not found
</code></pre>

<p>Any solution for this.</p>

<p>Thanks in advance.</p>

CC BY-SA 4.0
2018-09-13T14:49:26.767Z
That code is trying to connect to a bitcoin testnet node RPC running locally (`127.0.0.1` port `18332`). Do you have one running locally?
JBaczuk
CC BY-SA 4.0
2018-09-14T02:27:34.190Z
Yes I have one running locally.
Sarath Kumar
<bitcoin-core><blockchain><bitcoind><bitcoin-core-development>
how to get block information using node js
Sarath Kumar
# how to get block information using node js

(Asked by: username_0 on 2018-09-13)

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:'127.0.0.1', 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.

**Tags:** bitcoin-core, blockchain, bitcoind, bitcoin-core-development

> **Comments:**
> **username_1**: That code is trying to connect to a bitcoin testnet node RPC running locally (`127.0.0.1` port `18332`). Do you have one running locally?  
> **username_0**: Yes I have one running locally.  

---

## 1 answers

### Answer by username_1 on 2018-09-14. Score: 1 | Accepted answer

The function `client.getBlockchainInformation` and the other methods exposed by the `bitcoin-core` `npm` module use [bitcoin-core's REST interface.](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md) 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.

**e.g.**:

`$ bitcoind -rest`

or in **bitcoin.conf**

```
rest=1

```

> **Comments:**
> **username_0**: Can you please suggest me how tether node is setup like a bitcoin.  
> **username_1**: If it is unrelated to this post, please create a new question.  

---

