bitcoinjs / bitcoinjs-lib

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

Signature Verification Example for P2SH(P2WPKH) #1278

Closed nickmonad closed 5 years ago

nickmonad commented 5 years ago

Apologies if this has been asked already, but can someone show me a quick example of validating the signature for a P2SH(P2WPKH) transaction? (pay-to-witness-public-key-hash wrapped in a pay-to-script-hash)

The integration test validates a basic P2PKH transaction, but I've been struggling to validate one for P2SH(P2WPKH). Broadcasting my raw transactions to testnet is working, but it's always good to validate this stuff in a test suite.

Thanks!

nickmonad commented 5 years ago

@dcousens I got a notification for your follow up, but for some reason I'm not seeing it on GitHub now. Anyway, my aim is to simply validate the inputs I've created in my transaction have valid segwit signature (when the UTXO being spent is a P2SH(P2WPKH) output)

dcousens commented 5 years ago

See https://github.com/bitcoinjs/bitcoinjs-lib/pull/1279