Questions tagged [sighash-flags]

20 questions
9
votes
1 answer

What SIGHASH flags does CoinJoin use?

What SIGHASH flags are used when constructing a CoinJoin transaction?
Nick ODell
  • 29,184
  • 11
  • 69
  • 129
7
votes
1 answer

Do we still need SIGHASH_NOINPUT for Lightning Network?

In the original Lightning whitepaper, Joseph Poon advocates using SIGHASH_NOINPUT so that we can create the first commitment transaction which references the funding transaction txid without actually signing the funding transaction. However that…
6
votes
1 answer

Can't verify Taproot signatures that use SIGHASH_ANYONECANPAY

I wrote a program that verifies signatures for Taproot transactions using the secp256k1 library. My program works perfectly for SIGHASH_ALL, SIGHASH_NONE and SIGHASH_SINGLE. But in February, we saw the beginning of a huge wave of Taproot…
Zephyrus
  • 536
  • 2
  • 10
5
votes
1 answer

What is SIGHASH_ANYPREVOUTANYSCRIPT?

BIP 118 describes SIGHASH_ANYPREVOUT, but also mentions SIGHASH_ANYPREVOUTANYSCRIPT. What is the difference, and why is the later sighash flag needed?
4
votes
1 answer

How was FORKID used in Bitcoin Cash at the original fork point and in all upgrades since?

References: https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/replay-protected-sighash.md https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/2018-nov-upgrade.md It looks to me like at the original fork point,…
pinhead
  • 4,932
  • 2
  • 23
  • 38
4
votes
1 answer

Why are SIGHASH flags signed as 4 bytes when only 1 byte is included in the transaction?

This article brought to my attention that SIGHASH flags are 4 bytes long when signed, but only the last byte is actually included in the transaction. Then OP_CHECKSIG adds 3 bytes 0x000000 back on before verifying the signature. The article…
pinhead
  • 4,932
  • 2
  • 23
  • 38
4
votes
0 answers

Which wallets are spending P2TR with SIGHASH_ALL?

I noticed there are quite a lot of transactions spending taproot key path inputs that use SIGHASH_ALL instead of SIGHASH_DEFAULT in signatures (around 20% in the last two weeks). Recall that SIGHASH_DEFAULT is a sighash flag introduced in BIP341…
Vojtěch Strnad
  • 5,623
  • 1
  • 8
  • 31
3
votes
1 answer

I'm trying to create a new kind of escrow with bitcoin, not sure if it's possible

First off, I understand that the standard way to do escrow with bitcoin is a P2SH with a 2 of 3 multisig redeem script. I'd like to try and do escrow in the following way: names of 3 parties involved: money source escrow agent money…
2
votes
1 answer

For a transaction with a single input and output, is there a difference between SIGHASH_ALL and SIGHASH_SINGLE|SIGHASH_ANYONECANPAY

I have an signing implementation that already works for SIGHASH_ALL, and I'm trying to also support SIGHASH_SINGLE|SIGHASH_ANYONECANPAY. I'm referencing https://en.bitcoin.it/wiki/OP_CHECKSIG for the behaviors of different SIGHASH types. From my…
Roy Tang
  • 121
  • 3
2
votes
1 answer

What is the transaction hash preimage for different values of SIGHASH (not SIGHASH_ALL) in P2PKH?

I have a few questions regarding the transaction hash preimage when signing with different values of the SIGHASH flag in the case of the P2PKH script. I know what the transaction hash preimage looks like in case of SIGHASH_ALL, but what does it look…
Filip
  • 423
  • 8
1
vote
2 answers

Do you sign only the previous output of transaction?

I need to confirm that I understand how transactions work in the Bitcoin network. Ok, so: Alice is a network node. Alice wants to send bitcoins to someone in the network. Alice is creating a transaction using her wallet. Every transaction has…
ddavi031
  • 459
  • 2
  • 9
1
vote
1 answer

What goes in the tx hash preimage when signing with 0x83 (SINGLE|ANYONECANPAY)?

I have script to create a P2WPKH to P2WPKH transaction (1 input, 1 output) and sign it with the sighash type 0x01 SIGHASH_ALL. Which fields would I need to change in the tx digest preimage to turn the signature into one with a sighash type of 0x83…
Darius
  • 779
  • 4
  • 16
1
vote
1 answer

How to specify the right input and output to be signed for SIGHASH_SINGLE

For my understand, when building a new TX, need to produce a new scriptSig for the TX; and need add a sigHash code at the end of the TX. If the sighash type is SIGHASH_SINGLE, for a TX with multiple input and output, how to specify the right input…
yrm23
  • 51
  • 1
  • 5
1
vote
1 answer

SIGHASH_SINGLE vbuterin/pybitcointools

Checking the implementation of Buterin's bitcoin tools I've noticed something strange. According to the Bitcoin developers guide, sighash_single signs only the outputs that match the input where the scriptSig is going to be placed, that is, input i…
sr_gi
  • 3,087
  • 1
  • 11
  • 36
1
vote
1 answer

Using SIGHASH_NONE in P2SH address

I know that using SIGHASH_NONE in signatures is safe for a transaction only if at least one of the inputs is signed with SIGHASH_ALL, so that a miner can't change the outputs and reclaim the inputs. This kind of transaction is useful when the…
1
2