<p>Try this </p>

<pre><code>const bitcore = require("bitcore-lib");
const Insight = require("bitcore-explorers").Insight;
insight = new Insight(bitcore.Networks.testnet);
</code></pre>

<p>then do the rest.</p>

CC BY-SA 4.0
2019-05-18T23:42:47.960Z
2019-05-18T23:42:47.960Z
volki
<p>I am using bitcore explorer and I want to initialize insight api in testnet.
It has the following code.
I try <code>var insight = new Insight('testnet')</code> but it is not working.
What value for url should i input so that  <code>Networks.get(url) === testnet</code></p>

<pre><code>function Insight(url, network) {
  if (!url &amp;&amp; !network) {
    return new Insight(Networks.defaultNetwork);
  }
  if (Networks.get(url)) {
    network = Networks.get(url);
    if (network === Networks.livenet) {
      url = 'https://insight.bitpay.com';
    } else {
      url = 'https://test-insight.bitpay.com';
    }
  }
  JSUtil.defineImmutable(this, {
    url: url,
    network: Networks.get(network) || Networks.defaultNetwork
  });
  this.request = request;
  return this;
}
</code></pre>

<transactions><bitcoin-core>
Bitcore explorer insight testnet initialisation
vincentsty
# Bitcore explorer insight testnet initialisation

(Asked by: username_0 on 2018-06-06)

I am using bitcore explorer and I want to initialize insight api in testnet.
It has the following code.
I try var insight = new Insight('testnet') but it is not working.
What value for url should i input so that  Networks.get(url) === testnet
function Insight(url, network) {
  if (!url && !network) {
    return new Insight(Networks.defaultNetwork);
  }
  if (Networks.get(url)) {
    network = Networks.get(url);
    if (network === Networks.livenet) {
      url = 'https://insight.bitpay.com';
    } else {
      url = 'https://test-insight.bitpay.com';
    }
  }
  JSUtil.defineImmutable(this, {
    url: url,
    network: Networks.get(network) || Networks.defaultNetwork
  });
  this.request = request;
  return this;
}

**Tags:** transactions, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2019-05-18. Score: -1

Try this 
const bitcore = require("bitcore-lib");
const Insight = require("bitcore-explorers").Insight;
insight = new Insight(bitcore.Networks.testnet);

then do the rest.


---

