bitcoinbitcoin-testnet

Bitcoin address prefix/version for regtest


I've built a JS library to validate Bitcoin address and detect their type and network (mainnet, testnet, regtest).

For bech32 addresses, I can determine if they're for mainnet, testnet or regtest by looking at the prefix (bc, tb or bcrt).

For regular addresses, I can match them to mainnet or testnet only.

This is what I'm using to match regular addresses, based on the Address prefixes wiki list:

const addressTypes = {
  0x00: {
    type: 'p2pkh',
    network: 'mainnet'
  },

  0x6f: {
    type: 'p2pkh',
    network: 'testnet'
  },

  0x05: {
    type: 'p2sh',
    network: 'mainnet'
  },

  0xc4: {
    type: 'p2sh',
    network: 'testnet'
  }
};

Is there a way to match regular addresses to regtest, or are they technically equal to testnet addresses?


Solution

  • Regtest and Testnet legacy addresses are equal.

    To verify:
    When you import a regtest private key to testnet wallet, the address will be the same