question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add network definition for blockcypher test net

See original GitHub issue

Since the official testnet3 is very unreliable, other solutions have to be found for automated testing. Blockcypher manages a separate test network with identical properties of the bitcoin main network. One exception is that they use a different prefix for addresses.

I tried to use their test network with addresses generated with bitcoinjs-lib, but neither the main nor the testnet network definitions from bitcoinjs-lib produce valid addresses for their test network. It would be great if there was a network definition for the blockcypher test network in bitcoinjs-lib.

Here is the information about that network, quoted from https://www.blockcypher.com/dev/bitcoin/#testing:

We offer two different options for testing your blockchain application: Bitcoin Testnet3, and BlockCypher’s Test Chain. We offer automated faucets for both Testnet3 and BlockCypher’s Test Chain, but we recommend using BlockCypher’s Test Chain for a variety of reasons:

It’s nearly identical in characteristics to Bitcoin Main, with a few differences listed below.

  • The prefix for standard addreses is ‘B’ or 'C’ (0x1B). The prefix for multisig addresses is ’D’ (0x1F). This is also known as the “address version byte,” which you can read more about here.
  • The chain is private (no data is broadcasted, only BlockCypher mines the transactions), making it much more predictable than the Bitcoin’s testnet (which is frequently under attack).
  • New blocks get built every minute, confirming the transactions that have been created using our transaction API.

It would be great if someone could add such a network definition, or tell me which values have to be changed (with respect to the quoted information above) in the following code snippet, so I can make a PR myself:

{
  messagePrefix: '\x18Bitcoin Signed Message:\n',
  bech32: 'bc',
  bip32: {
    public: 0x0488b21e,
    private: 0x0488ade4
  },
  pubKeyHash: 0x00,
  scriptHash: 0x05,
  wif: 0x80
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

19reactions
sonayecommented, Jan 1, 2018

Quick update: the version is actually 0x49 not 0x80.

const networks = {
  btc: {
    main: bitcoin.networks.bitcoin,
    test3: bitcoin.networks.testnet
  },
  ltc: {
    main: bitcoin.networks.litecoin
  },
  bcy: {
    test: {
      messagePrefix: '\x18Bitcoin Signed Message:\n',
      bech32: 'bc',
      bip32: {
        public: 0x0488b21e,
        private: 0x0488ade4
      },
      pubKeyHash: 0x1b,
      scriptHash: 0x1f,
      wif: 0x49
    }
  }
};
1reaction
dabura667commented, Nov 8, 2017

adding it kinda seems like a plug for an external service… so I am starting to lean towards no, actually now that I think of it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction – Blockchain Developer API for Bitcoin, Ethereum ...
BlockCypher is a simple, mostly RESTful JSON API for interacting with blockchains, accessed over HTTP or HTTPS from the api.blockcypher.com domain. Currently, ...
Read more >
Testnet - Bitcoin Wiki
The testnet is an alternative Bitcoin block chain to be used for testing. Testnet coins are separate and distinct from actual bitcoins, ...
Read more >
Testnet, the testing network for Bitcoin - Bit2Me Academy
In this chapter we will talk about the network (unknown to many) called Testnet, the network of bitcoins that are worth nothing and...
Read more >
BlockCypher | Drupal.org
The BlockCypher module allows you to quickly and easily start querying and transacting data on various blockchain networks in your own ...
Read more >
Blockcypher new transaction request returning more than ...
I am trying to use Blockcypher APIs to create (and sign) and send a transaction (on testnet). The request i provide has 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found