Hello guys, help much appreciated.
I use to be able to derive addresses from xpub keys like this (version 3.x.x) (note that the xpubkey I'm using is not segwit)
bjs.HDNode.fromBase58(xpub, network).neutered()
.derive(0)
.derive(0)
.getAddress()
I've upgraded to 4.0.1 and it does not work anymore. I've tried
bjs.bip32.fromBase58(xpub, network)
.derive(0)
.derive(0)
.getAddress()
but I get _bitcoinjsLib.bip32.fromBase58(...).derive(...).derive(...).getAddress is not a function"
also tried
const pubkey = bjs.bip32.fromBase58(xpub, network)
.derive(0)
.derive(0)
.getPublicKeyBuffer()
const { address } = bjs.payments.p2sh({
redeem: bjs.payments.p2wpk({
pubkey: pubKey
})
})
but I get _bitcoinjsLib.bip32.fromBase58(...).derive(...).derive(...).getPublicKeyBuffer is not a function
Anyone care to explain ? thank you very much
ok I've firgured it out:
const pubkey = bip32.fromBase58(xpub, network)
.derive(0)
.derive(0)
return bjs.payments.p2pkh({ pubkey: pubkey.publicKey, network }).address
Most helpful comment
ok I've firgured it out: