bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.65k stars 2.09k forks source link

Can't create regtest p2wpkh address #1260

Closed Janaka-Steph closed 5 years ago

Janaka-Steph commented 5 years ago

Hello,

I am trying to run the P2WPKH test on my machine, using Bitcoin Core on regtest mode to fund the p2wpkh address manually. The address starts with tb, which is not what I want because Core is using bcrt address prefix on regtest.

Bitcoinjs doesn't have a regtest object in bitcoin.networks, so what am I suppose to do? Is bitcoinjs able to produce a regtest p2wpkh address? Thank you.

junderw commented 5 years ago

Is bitcoinjs able to produce a regtest p2wpkh address?

If you create a custom network, yes.

The network object is not that complicated, you can make a custom one to meet your needs.

dcousens commented 5 years ago

Check the integration tests, they use testnet for regtest?

edit: PR wanted

junderw commented 5 years ago

@dcousens He is saying that regtest has a different bech32 value for segwit.

bech32: 'bcrt'

dcousens commented 5 years ago

Make a PR please that adds regtest and respective constants and use it in the integration tests :+1:

junderw commented 5 years ago

@dcousens https://github.com/bitcoinjs/bitcoinjs-lib/pull/1261

dcousens commented 5 years ago

@Janaka-Steph please see #1261, thanks @junderw