0

For the examples below I am going to be talking of 1-of-1 multisig only derived from a single private key.

For P2WPKH, the address is generated using using hash160 of the public key which acts as the witness program.

For P2WSH, is there any standard witness program? The demo in https://bc-2.jp/tools/bech32demo/index.html uses <pubkey> OP_CHECKSIG[0xac] as the WitnessScript. While bitcoinaddress pip package uses a different approach (see https://github.com/fortesp/bitcoinaddress/blob/master/bitcoinaddress/address.py#L130-L133 )

(Please excuse any wrong nomenclature I might have used in this question)

3
  • Note that witness program and witness script are not the same thing (the first is the OP_n + hash placed in the scriptPubKey; the second is the actual script executed. Also, you're asking about a standard witness script to do what? A 1-of-1 multisig is pointless. – Pieter Wuille Jan 11 at 22:23
  • @PieterWuille Thanks for your reply Pieter (SegWit designer). So what I am asking is about a standard witness script to create a P2WSH address. (In Samourai wallet, I have noticed I have P2WSH addresses, and so I was wondering how it was created.) – The Gripmaster Jan 12 at 1:53
  • A standard witness script for what? A script is a program, it does something. The question is what do you want it to do? – Pieter Wuille Jan 12 at 2:05
0

It is 0 and a 32-byte push of Sha256 of the scriptPubKey (which is the script you use to generate the address). You can find an example here: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wsh

The Python example you linked uses WP2PSH as WP2PKH. You can see the how WP2PKH works here: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wpkh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.