Skip to main content
5 votes

What is the purpose of P2WPKH-P2SH?

P2SH-P2WPKH addresses can only be created by segwit-compatible wallet software. However, sending to a P2SH-P2WPKH works with any P2SH-compatible wallet, as the address is indistinguishable from (and ...
Pieter Wuille's user avatar
4 votes
Accepted

How is this transaction valid?

The signature is actually valid. The sighash is 8cc2772af5af61583c5a7ae89f777d3173afa470ce8b1bfa5f8d4b9a54635ccb and you'll find that the signature does indeed validate. So the question is how is this ...
Ava Chow's user avatar
  • 70.5k
4 votes
Accepted

How to build a transaction using bitcoinjs-lib

In P2SH, the output script is created by applying HASH160 (SHA256+RIPEMD160) to the redeem script, which is then revealed at spend time. So if you created the previous output, you should know what the ...
Vojtěch Strnad's user avatar
3 votes

Can a spend before a timestamp condition be put on a Bitcoin UTXO?

You can do this by creating a P2WSH output with the following script: OP_IF <condition 1> OP_ELSE <timestamp> OP_CHECKLOCKTIMEVERIFY OP_DROP <condition 2> OP_ENDIF Then ...
Vojtěch Strnad's user avatar
3 votes

What are the scriptPubKey, scriptSig, redeem script and witness for the various output types?

I thought it would be useful to have a text version of the image of a table in Michael Folkson's answer. If only for accessibility reasons. (it initially proved rather too hard to edit into his answer ...
RedGrittyBrick's user avatar
2 votes

How can I create a simple P2SH transaction in regtest?

Yes we could do that easily, first we launch bitcoin core on regtest bitcoind -regtest -fallbackfee=0.0002 -daemon then we create and load a wallet bitcoin-cli -regtest createwallet "my_wallet&...
Saxtheowl's user avatar
  • 2,800
2 votes
Accepted

Why do some P2SH spending transactions have data both in the ScriptSig and Witness field?

SegWit introduced a compatibility mode usually called wrapped SegWit or nested SegWit. It allows you to create a P2SH output spendable using SegWit rules, which include the witness discount and ...
Vojtěch Strnad's user avatar
2 votes

Why do some P2SH spending transactions have data both in the ScriptSig and Witness field?

You are looking at a transaction that spends wrapped-segwit (2-of-3 P2SH-P2WSH) inputs. Wrapped segwit was introduced as a bridging technology with segwit, because other than native segwit addresses, ...
Murch's user avatar
  • 75.4k
2 votes

Can a spend before a timestamp condition be put on a Bitcoin UTXO?

It's not possible to set spend conditions which expire on a Script. It's sometimes referred to as an "inverse timelock". It is widely believed to not be desirable as a valid Script becoming ...
Antoine Poinsot's user avatar
2 votes

HOW TO SPEND P2SH with Redeem Script Hex?, Already make the transaction but still have some error

"scriptsig-not-pushonly" refers to the consensus rule that the scriptSig of a P2SH input must only include push operations (see BIP16). Your scriptSig not only includes opcodes other than ...
Vojtěch Strnad's user avatar
2 votes
Accepted

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

Since it is a segwit address you should use fromAddress2 = pub2.get_segwit_address() Also, while taproot (segwit v1) requires the scriptPubKey when signing, segwit v0 requires the script code; i.e. a ...
karask's user avatar
  • 2,540
1 vote
Accepted

How is tapscript different than P2PKH using opcodes from a developer perspective?

It sounds like this means that I could do an ordinal in a non-taproot address bitcoin transaction. So I could mint an ordinal with a P2PKH address. Historically output types with address standards ...
Murch's user avatar
  • 75.4k
1 vote

What if someone locks some bitcoin with a script which only requires a user to know a preimage, but it matches the p2sh template?

Yes, that could happen. However it is also possible to inspect the blockchain for such outputs, and none exist that weren't known to be for testing.
Ava Chow's user avatar
  • 70.5k
1 vote
Accepted

descriptor and Custom script

OP_1 <Public Key hash> <Public Key hash> <Public Key hash> 3 OP_CHECKMULTISIGVERIFY OP_3 OP_EQUAL This is not a valid use of CHECKMULTISIGVERIFY. This script would not be spendable. ...
Antoine Poinsot's user avatar
1 vote
Accepted

Transaction keep beeing rejected "non-mandatory-script-verify-flag"

Code: -26, Error: non-mandatory-script-verify-flag (Witness requires empty scriptSig) bitcoin-cli is telling you that, in order for a SegWit transaction to be valid, the scripSig field must be empty (...
sr_gi's user avatar
  • 3,220

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