p2wpkh – Convert WIF to Witness PubKey Hash Handle in Go

0
18


There are 2 circumstances the place the model byte within the witness program is both 0 or 1.
If the model byte is 0, you want a 20-byte HASH160 of the general public key. Reference wiki.

witnessProg := btcutil.Hash160(w.SerializePubKey())
p2wpkh, err := btcutil.NewAddressWitnessPubKeyHash(witnessProg, chainParams)

However I’m not actually certain in regards to the case the place model byte is 1.

Edit: earlier implementation was most likely mistaken, fastened after some extra analysis.



Supply hyperlink

Leave a reply