Hot answers tagged

8 votes

P2WSH, witness_v0_scripthash: how to derive an address

It's a Segwit output and hence does not have the address associated with it. The locking script for a Segwit transaction includes the witness version (0 in this case) and the redeem script (which is ...
user avatar
  • 6,978
7 votes
Accepted

Will P2TR make P2WSH obsolete?

As far as I can tell, P2TR is better than P2WSH in almost every way. I cannot think of a case in which it would be a significant advantage to use P2WSH over P2TR, except that P2WSH is already ...
user avatar
  • 64.5k
7 votes
Accepted

In simple terms, what are the major differences between P2WPKH and P2WSH bech32 addresses?

P2WPKH - This stands for "Pay To Witness Public Key Hash" and the scriptPubkey is OP_0 0x14 {20-byte-hash}, where OP_0 is the version, byte 0x14 is the size of the data, and the {20-byte-hash} is a ...
user avatar
6 votes
Accepted

Can a coinbase transaction have a segwit output?

Other than the total value needing to be correct (no more than the block reward plus fees), the outputs of a coinbase transaction are completely unrestricted and act the same as any other transaction.
user avatar
  • 15.1k
6 votes
Accepted

Why are P2WSH addresses larger than P2SH addresses?

Because P2SH addresses are too short to provide typically desirable levels of security security level we expect from Bitcoin, against certain attacks. On top of that, they use bech32 encoding rather ...
user avatar
6 votes

Constructing a P2WSH address from the BIP173 spec

First of all, what are you trying to do? Why do you need a P2WSH address? A P2WSH address (and P2SH addresses earlier) send coins to a script, which requires satisfying that script to decode. A ...
user avatar
5 votes
Accepted

generate a P2SH-P2WSH address and spend output sent to it

bitcoin-cli's signrawtransaction expects a few arguments. You got most of them right, but forgot to add the details for redeeming the actual p2wsh part. Specifically for p2sh(p2wsh), you'd need to ...
user avatar
  • 1,814
4 votes
Accepted

how do you tell P2WSH invoice addresses apart from P2SH?

P2PKH addresses are 33-34 characters long, use Base58Check encoding, and (on mainnet) start with "1". P2SH addresses are 34 characters long, use Base58Check encoding, and (on mainnet) start ...
user avatar
4 votes
Accepted

Support for P2WSH-wrapped P2TR addresses

In addition to the rationale given in BIP 341, I know of two arguments for not supporting P2SH-wrapped taproot outputs: backwards-compatibility: P2SH-wrapped segwit outputs were included in BIP 141 ...
user avatar
  • 900
3 votes

Why are P2WSH addresses larger than P2SH addresses?

The encoding is bech32 not base58, which is slightly longer but vastly easier to type due to a lack of capital letters, and the inclusion of error correction rather than error detection. SegWit ...
user avatar
  • 15.1k
3 votes
Accepted

Constructing a P2WSH address from the BIP173 spec

When you push items on the stack you must use an opcode to state how long the item you are pushing is. In this case you want to push 33 bytes so OP_PUSH33 Your script would be: OP_PUSH33 ...
user avatar
  • 3,225
3 votes
Accepted

How to generate a P2WSH address

To generate a P2WSH address, you need to have some script. The easiest one you can use is a multisig script. You can do this with the command addmultisigaddress. If you do something like ...
user avatar
  • 62.4k
2 votes

P2WSH, witness_v0_scripthash: how to derive an address

Native segwit outputs (P2WSH and P2WPKH) do not currently have an address type, so there are no addresses for these outputs.
user avatar
  • 62.4k
2 votes
Accepted

What is the signature digest for Segwit outputs

For signatures in P2WPKH and P2WSH spends, the sighash algorithm is described in BIP143. It is very different from the one used in legacy spends.
user avatar
2 votes
Accepted

Help signing a P2WSH Multisig

I found the problem, in the bip143 tx digest preimage, the scriptCode needs to be preceded by the length of the scriptCode. In this case 0x47
user avatar
  • 689
2 votes

What is "Witness"?

This is a transaction with three P2WPKH (native segwit v0 single-sig) inputs and a single P2WPKH output. For P2WPKH, the scriptPubKey (the locking script encoded in an output) contains a witness ...
user avatar
  • 64.5k
2 votes
Accepted

Generate P2WSH native

Bech32 encoding, apart from the checksum, is a simple matter of converting base-256 (8-bits) to base-32 (5-bits). Base-256 is the byte array (octet string) that you get from a hash function. Only ...
user avatar
1 vote
Accepted

problem with unlocking P2WSH

The error you are encountering is the requirement for the minimal encoding of data. Specifically, your witness stack contains 0x00 for the number 0. However this is not the minimal encoding of 0. ...
user avatar
  • 62.4k
1 vote

What is the exact size and weight of a 2-of-2 P2WSH input?

TL;DR: A 2-of-2 P2WSH input should be conservatively estimated with 96 vbytes. Standard 2-of-2 P2WSH inputs generally weigh 95.5, 95.75 or 96.0 vbytes, depending on whether the r-values in the ...
user avatar
  • 64.5k
1 vote
Accepted

Is the dust output limit the same for p2wpkh and p2wsh?

I just realized that there are in fact these two lines which takes into account the size of CTxOut: size_t nSize = GetSerializeSize(txout); ... ... nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) ...
user avatar
  • 689
1 vote

Generate P2SH-P2WSH

At the time this question was asked, this issue was the result of a bug in Bitcoin Core. It was fixed in PR #18484 and is available in Bitcoin Core 0.20+.
user avatar
  • 62.4k
1 vote
Accepted

What is the scriptCode in a P2WSH transaction?

Yes, the scriptCode would be that multisig script.
user avatar
  • 62.4k
1 vote
Accepted

anyonecanspend final condition of a script can be spotted just by looking at the script hash, without the redeem data?

As there are no known preimage attacks on RIPEMD160 and SHA256, it is impossible to know what the contents of a redeemScript are given just the scriptHash. So yes, it is impossible to know what ...
user avatar
  • 62.4k
1 vote
Accepted

Create Pay to Witness Script Hash in Pay to Script Hash Address

This is indeed an error in the book: https://github.com/bitcoinbook/bitcoinbook/issues/440 See this diff for the correct steps.
user avatar
1 vote

Create Pay to Witness Script Hash in Pay to Script Hash Address

Seems to me that ... creating a Pay-to-Witness-Script-Hash (P2WSH) output that would look like this: 0 9592d601848d04b172905e0ddb0adde59f1590f1e553ffc81ddc4b0ed927dd73... means that this hash ...
user avatar
  • 6,650

Only top scored, non community-wiki answers of a minimum length are eligible