Skip to main content

Questions tagged [p2wsh]

Pay to Witness Script Hash is the native SegWit v0 script output format. P2WSH addresses are Bech32 encoded and start with the prefix `bc1q`.

Filter by
Sorted by
Tagged with
0 votes
1 answer
128 views

How to spend P2WSH address with full redem script and witness program?

I just put few dollar in here. Bech32 Address: bc1qx6c07u2s6pu6d5ede8ee9hmynahp9edgg764cm58gfxmryk3ryqsxarnnv Witness Script Hex 76a914b1217062623d9101426f61593cb1abc3e44ed00488ac Witness Script Asm ...
3 votes
2 answers
618 views

How to calculate P2WSH signatures with OP_CODESEPARATOR?

I read the bip143, but didn't understand how to calculate the scriptCode of p2wsh. bip143 told us: A new transaction digest algorithm is defined, but only applicable to sigops in version 0 witness ...
2 votes
0 answers
176 views

spend founds from p2wsh address,non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 64)

i want spent coin from p2wsh address on btc testnet3 network, i use bitcoinj 0.15.2 build transaction and sign it, use 2/3 multiSig when i send raw transaction by bitcoin core 0.17.0 command line by ...
2 votes
1 answer
190 views

Create and spend P2WSH that locks coins with OP_CHECKLOCKTIMEVERIFY

I'm attempting to create a P2SWH address with a script that locks the coins for some time. And then I want to spend those coins from that address. I've read a lot, some of the most relevant: BIP173 ...
1 vote
1 answer
268 views

Can't sign using Trezor T derived multisig wallet using Electrum | Invalid script_type

I created a P2WSH multisig wallet using Electrum 4.0.9 using a single Trezor T, to which I sent a large amount of BTC. Electrum allowed me to set up the wallet using the same device when I used two ...
2 votes
1 answer
121 views

Properly Import P2WSH Descriptors into a Watch-Only Wallet to Reflect All Balances and Transactions

I'm trying to import a Pay-to-Witness-Script-Hash (P2WSH) descriptor into my Bitcoin Core watch-only wallet using the importdescriptors command. My goal is to ensure that the wallet reflects all ...
1 vote
1 answer
171 views

P2WSH Bitcoin Core Witness Script Empty Error

I am trying to spend a P2WSH output. Here are the steps I have taken: I have created a P2WSH output via bitcoin-cli. These are the details of the P2WSH output: Type V0_P2WSH scriptPubKey (asm) OP_0 ...
0 votes
0 answers
54 views

PT2R and P2WSH Addresses from Public key hex

I'm trying to form addresses PT2R and P2WSH from Public key hex. Receiving this Public key hex from API like array of objects: const data = [ { staker_pk_hex: "...
7 votes
1 answer
344 views

Will P2TR make P2WSH obsolete?

Assuming users have upgraded their wallets to handle P2TR outputs and trust the validation rules of P2TR, would there be any advantage of using P2WSH over P2TR?
2 votes
1 answer
210 views

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

I'm proofreading an article mentioning the cost reduction of P2TR for Lightning channels in comparison to P2WSH. To that end, I'm looking for the precise weight, vsize and serialized length of a 2-of-...
4 votes
1 answer
411 views

Is there an economic incentive to use P2WSH over P2TR?

As I understand, p2pkh and p2sh are nothing better than p2wpkh and p2wsh, other than compatibilty. After taproot, p2wpkh is also nothing better than p2tr, other than compatibilty(no economic incentive ...
0 votes
1 answer
123 views

Why does my PSBT's input script not have a pub key?

I have created a PSBT to sign an HTLC using a funded P2WSH, that I wish to sign with my xverse wallet. This is my decoded PSBT which I have created using bitcoin-cli o@OscarPC:~/bitcoin-htlc$ bitcoin-...
-1 votes
1 answer
32 views

Code: -26, Error: non-mandatory-script-verify-flag (Data push larger than necessary)" when trying to spend from P2WSH

I have sent to a P2WSH but I can't spend from this address because I get this error; Code: -26, Error: non-mandatory-script-verify-flag (Data push larger than necessary)" This is the script that ...
4 votes
1 answer
119 views

Why is my P2WSH OP_IF/NOTIF argument not minimal?

I have created an HTLC with the following Bitcoin script using bitcoinlib-js: const redeemScript = bitcoin.script.compile([ bitcoin.opcodes.OP_IF, bitcoin.opcodes.OP_SHA256, ...
0 votes
2 answers
244 views

Verifying a P2WSH by hand

To test my understanding of the signing and verifying process i tried to verify some random Bitcoin transactions by hand. Sadly i got stuck with a P2WSH transaction, i choose the following transaction ...
1 vote
1 answer
46 views

broadcast ps2wsh transaction failed

Greeting, I hope someone can guide me about what is wrong with my p2wsh transaction hex below ...
0 votes
0 answers
42 views

How to sign P2WSH PSBT with sats-connect?

I have created a funded P2WSH script, which is an HTLC. I now want to create a PSBT which will be signed by another wallet to withdraw the funds. The problem is that the PSBT signing is throwing the ...
0 votes
0 answers
49 views

How to send BTC to P2WSH address using sats-connect?

How can I send BTC to a P2WSH address with sats-connect? The sats-connect documentation provides the following API for sending bitcoin on the testnet. I would like to use this API so I can fund HTLC ...
3 votes
1 answer
155 views

Failing to construct transaction that unlocks P2WSH

I am trying to unlock the P2WSH output of the following transaction: https://blockstream.info/testnet/tx/b435b180c936564cc902ce3d7011643836a74d671159d494f59536e70d977cd2 The script that I'm paying to ...
0 votes
2 answers
929 views

Generating P2WSH addresses | Is there a standard WitnessScript?

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 ...
6 votes
2 answers
800 views

Why are P2WSH addresses larger than P2SH addresses?

One would, perhaps naively, assume that both addresses are hashes of scripts and therefore ought to be the same size.
1 vote
1 answer
281 views

Native P2WSH over P2SH | P2SH-P2WSH

I'm in the process of attempting to generate a transaction using the Python Bitcoin Utils library. that involves P2WSH-over-P2SH (P2SH-P2WSH). My activity is on the regtest network. Below is the code ...
1 vote
2 answers
45 views

Why is this P2WSH spend triggering a verification failure when broadcasting?

I'm experiment with building SegWit transactions manually, and I've written a non-standard simple script just for testing. No signing or anything, just your usual "add two numbers, check equality&...
2 votes
1 answer
291 views

How can I spend a mix of UTXOs (p2sh, p2wpkh, p2wsh) along with a p2tr UTXO?

I'm constructing a script to spend multiple distinct UTXOs in a single transaction. I've successfully combined all UTXOs except for two. Succeeding in spending a P2TR with P2PKH UTXO. I encountered a ...
1 vote
2 answers
195 views

Inscriptions with size less than 10Kb were seemingly possible before taproot, why did they become popular only now?

In 2017 SegWit soft fork introduced consensus limit on script size MAX_STANDARD_P2WSH_SCRIPT_SIZE=10000. With P2WSH, one could seemingly use the same script structure ("envelope") OP_FALSE ...
1 vote
1 answer
382 views

Where exactly is the Inscription media stored in witness signature? [duplicate]

Is it stored in the witness program as OP_FALSE OP_IF <data> OP_ENDIF or is it stored in annex as described in bip 341 or in some other form?
0 votes
1 answer
78 views

How can I optimize my python script that creates a btc native segwit tx with an OP_RETURN message?

I have the following code that successfully created a bitcoin transaction with an OP_RETURN message: from bitcoinutils.utils import to_satoshis from bitcoinutils.setup import setup from bitcoinutils....
4 votes
2 answers
116 views

Using multiple penalty transactions to increase max HTLCs per LN channel

BOLT#2 states the below as one rationale to limit a Lighting Network channel to 483 HTLCs: It also ensures that a single penalty transaction can spend the entire commitment transaction, as calculated ...
1 vote
1 answer
121 views

What was the first ever P2WSH transaction?

I've managed to find the first-ever segwit transaction, which is also the first-ever P2WPKH transaction: dfcec48bb8491856c353306ab5febeb7e99e4d783eedf3de98f3ee0812b92bad However I'm having trouble ...
1 vote
2 answers
143 views

In practice, are redeemScripts commonly reused?

In regards to P2SH-P2WSH transactions, are Txout-script values identical between transactions? Is it reasonable to expect a business or vendor that accepts bitcoin to be using the same redeemScript ...
1 vote
2 answers
175 views

Is the witness `version` of a bech32 address required to "send spendable funds" to the address?

Let's assume Alice has Bob's bech32 address (BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4). After decoding the address Alice knows that the address has a witness version of 0 AND 20 bytes of a hash (32 ...
0 votes
2 answers
204 views

non-mandatory-script-verify-flag (unknown error) with a script that runs ok in btcdeb

after learning a lot about script (and playing with them on the testnet) i made a way longer script. $ btc decodescript 7455886f94935688789352885279935b88946e935b88945187 { "asm": "...
0 votes
1 answer
184 views

problem with unlocking P2WSH

i made a P2WSH address with bitcoinjs-lib from a script. the same script results in the same address with bitcoin core. I made an unlocking script and tested the combination with btcdeb and everything ...
0 votes
3 answers
742 views

Generate P2SH-P2WSH

I want to generate P2SH-P2WSH with script P2PKH. My public key is 027712968e8f2f9dfa79abe10940a3d915a0c95a0b97750881e6201acf2b66da97 SHA256 and RIPEMD160 of Public key ---------- Witness Script ...
2 votes
1 answer
242 views

Problem spending funds from P2WSH address: non-mandatory-script-verify-flag

I've tried to find an answer here and on BTT but without luck so far. I'm having issues creating a transaction to spend from a P2WSH address which I created and sent funds to. I based my code off of ...
1 vote
1 answer
179 views

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

Consider the following scenario. Alice, Carol and Bob create and fund a script with the following rules: if now, alice pubkey, bob pubkey else if now+500 blocks, bob pubkey, carol pubkey else if now+...
2 votes
1 answer
1k views

How to generate a P2WSH address

getnewaddress "" bech32 generates a P2WPKH address (e.g. tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx). How can I generate a P2WSH address (e.g. ...
0 votes
1 answer
137 views

"pure" P2WSH invoice address in legacy wallets?

If I got it right, my legacy wallet seems to be able to get me: 2000s-era P2PKH invoice addresses (appearing as base58). P2SH-wrapped P2WSH invoice addresses (appearing as base58). P2WPKH invoice ...
2 votes
1 answer
164 views

how do you tell P2WSH invoice addresses apart from P2SH?

... and how do you tell P2WPKH invoice addresses apart from P2PKH?
1 vote
0 answers
154 views

Java bip32 library

I'm looking for java library that will cover bip32 address derivation (xpub to P2PKH, P2SH, P2WSH, P2WPKH, P2SH-P2WPKH). There seem to be a lot of libraries covering P2PKH, but not much else (like ...
1 vote
1 answer
1k views

What is "Witness"?

What really is "Witness"? I saw this data in blockchain and can not identify what it really is. Here is the dump of transaction for example. TX hash = ...
7 votes
1 answer
659 views

Support for P2WSH-wrapped P2TR addresses

Given that Taproot addresses use a new SegWit version and a new address encoding (bech32m), it's reasonable to expect a transition from the ecosystem to this new address version similar to what we saw ...
1 vote
1 answer
189 views

how to find p2sh/p2wsh in utxo set after wallet recovery

i'm trying to understand how wallets remember a redeem script for p2sh/p2wsh for spending, after recovering from their seed, because the utxo set only has the hash in it, right? there are a nearly ...
3 votes
1 answer
176 views

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

I've seen mentioned in a few places that the dust limit for an output to be considered standard is minRelayTxFee*3. Based on this, I would expect the dust limit for a p2wsh output to be larger than ...
1 vote
1 answer
314 views

Help signing a P2WSH Multisig

I'm trying to construct a transaction in regtest mode that spends from a P2WSH 2-of-2 multisig. Here is the funding transaction for 5 btc. It also contains a change output for 5 btc. ...
0 votes
0 answers
464 views

Bad witness error in P2SH-P2WSH

I've managed to build a P2SH 2-of-3 multisig contract that works, ie I can create addresses, send coins to them, and spend the outputs. Now I'd like to transition that solution to a P2SH-P2WSH, but I'...
1 vote
1 answer
381 views

Generate P2WSH native

I want to create P2WSH native like https://en.bitcoin.it/wiki/BIP_0173. I have already a script to generate P2WPKH and it works, thank the python part and re-arrange group byte works. I read that ...
3 votes
1 answer
189 views

Can a coinbase transaction have a segwit output?

And more generally speaking, are there any restrictions on the output of a coinbase transaction?
0 votes
1 answer
212 views

What is the signature digest for Segwit outputs

(Assume there's no OP_CODESEPERATOR) For standard P2PKH, the signature digest is generated this way: NewTransaction settle the TxOuts well set all TxIn scripts to empty insert the Previous Locking ...
1 vote
1 answer
277 views

What is the scriptCode in a P2WSH transaction?

Let's say I am spending from a 2-of-2 multisig with this script: ...