Add bitcoin regtest params

This commit is contained in:
Ian Coleman
2019-12-18 09:51:00 +11:00
parent 244c76022a
commit f12242014d
4 changed files with 81 additions and 0 deletions

View File

@@ -1738,3 +1738,16 @@ bitcoinjs.bitcoin.networks.elastos = {
scriptHash: 0xc4, // TODO set this correctly, same as BTC for now
wif: 0xef // TODO set this correctly, same as BTC for now
};
// https://github.com/bitcoinjs/bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js
bitcoinjs.bitcoin.networks.regtest = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bcrt',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef,
};

View File

@@ -2099,6 +2099,15 @@
setHdCoin(0);
},
},
{
name: "BTC - Bitcoin RegTest",
onSelect: function() {
network = bitcoinjs.bitcoin.networks.regtest;
// Using hd coin value 1 based on bip44_coin_type
// https://github.com/chaintope/bitcoinrb/blob/f1014406f6b8f9b4edcecedc18df70c80df06f11/lib/bitcoin/chainparams/regtest.yml
setHdCoin(1);
},
},
{
name: "BTC - Bitcoin Testnet",
onSelect: function() {

View File

@@ -28,6 +28,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wpkh = {
wif: 0xef
};
bitcoinjs.bitcoin.networks.regtest.p2wpkh = {
baseNetwork: "regtest",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bcrt',
bip32: {
public: 0x045f1cf6,
private: 0x045f18bc
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
// p2wpkh in p2sh
bitcoinjs.bitcoin.networks.bitcoin.p2wpkhInP2sh = {
@@ -56,6 +69,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wpkhInP2sh = {
wif: 0xef
};
bitcoinjs.bitcoin.networks.regtest.p2wpkhInP2sh = {
baseNetwork: "regtest",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bcrt',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
// p2wsh
bitcoinjs.bitcoin.networks.bitcoin.p2wsh = {
@@ -84,6 +110,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wsh = {
wif: 0xef
};
bitcoinjs.bitcoin.networks.regtest.p2wsh = {
baseNetwork: "regtest",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bcrt',
bip32: {
public: 0x02575483,
private: 0x02575048
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
// p2wsh in p2sh
bitcoinjs.bitcoin.networks.bitcoin.p2wshInP2sh = {
@@ -112,6 +151,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wshInP2sh = {
wif: 0xef
};
bitcoinjs.bitcoin.networks.regtest.p2wshInP2sh = {
baseNetwork: "regtest",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bcrt',
bip32: {
public: 0x024289ef,
private: 0x024285b5
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
bitcoinjs.bitcoin.networks.litecoin.p2wpkh = {
baseNetwork: "litecoin",
messagePrefix: '\x19Litecoin Signed Message:\n',

View File

@@ -412,6 +412,13 @@ it('Allows selection of bitcoin testnet', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of bitcoin regtest', function(done) {
var params = {
selectText: "BTC - Bitcoin RegTest",
firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
};
testNetwork(done, params);
});
it('Allows selection of litecoin', function(done) {
var params = {
selectText: "LTC - Litecoin",