2

Does anyone know if Bitcore offer a testnet API to play around with?

I'm implementing an Escrow system using the API and Node.js Thanks.

3 Answers 3

2

I figured this out, you need to set the default network after you instantiate bitcore.

var bitcore = require('bitcore'); 

// Set the network to testnet
bitcore.Networks.defaultNetwork = bitcore.Networks.testnet;
2
  • It seams this does not work anymore. bitcore.Networks is now bitcore.networks and bitcore.networks.defaultNetwork = bitcore.networks.testnet throws Error: Cannot find module './build/Debug/buffertools.node'
    – Giszmo
    Commented Sep 6, 2017 at 16:14
  • This is no longer supported I think.
    – rjmacarthy
    Commented May 25, 2021 at 10:22
0

I had to mess around with this until I got it. Kinda silly it wasn't any where in the docs...

This is via Typescript

import * as bitcore from 'bitcore-lib'

bitcore.Networks['defaultNetwork'] = bitcore.Networks['testnet']
-1

Close bitcoind and then start bitcoind in a terminal or bash shell like so: "bitcoind -testnet" Using that should cause bitcoin to use a test network.

Although on windows you might need to find the bitcoind.exe and execute that if the command bitcoind is not added to the system path.

This information was retrieved from bitcoin's core using "bitcoind -help" and a quote from it says "-testnet Use the test network"

2
  • 2
    Bitcore != Bitcoin core FWIW Commented Apr 23, 2015 at 5:09
  • I asked about Bitcore not bitcoind...
    – rjmacarthy
    Commented May 21, 2015 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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