Questions tagged [sighash-flags]
The sighash-flags tag has no usage guidance.
21
questions
1
vote
2
answers
277
views
Strange double-spending attack possibility
In Bitcoin you can have different UTXO with different public keys in a single transaction.
So suppose someone broadcasts a transaction with sending 10000 BTC. Theoretically I can copy this transaction,...
1
vote
1
answer
98
views
Trying to make SIGHASH_SINGLE transaction
I am trying to make a SIGHASH_SINGLE transaction.
I have two inputs, one output. I understand that second input can be not signed (really?).
Script I have is:
#!/usr/bin/env python3
import hashlib
...
1
vote
1
answer
167
views
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 ...
5
votes
0
answers
76
views
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 ...
6
votes
1
answer
334
views
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 ...
1
vote
1
answer
119
views
SIGHASH_SINGLE with no corresponding output
Transaction 99fc1e5c753459808bac56435b3d45f2fcf0dd73016ea14460d63e9ddf353714 is an interesting example.
This transaction has 5 inputs and 1 output. All of the input scripts include 1 public key and 1 ...
5
votes
1
answer
340
views
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?
1
vote
2
answers
382
views
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 ...
0
votes
1
answer
52
views
Is it possible to reference an input outpoint more than once in a transaction?
For example, could you have the following transaction:
A --> B
A --> C
Where A is an input txid and index, and B and C are outputs? The reason I'm asking is because I believe with SIGHASH_SINGLE ...
1
vote
1
answer
318
views
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 ...
7
votes
1
answer
988
views
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 ...
0
votes
1
answer
125
views
Is SIGHASH_NONE encompassing of other signature types?
Say I am building a transaction in private:
Input 1 is signed with SIGHASH_SINGLE ( | SIGHASH_ANYONECANPAY)
Input 2 is signed with SIGHASH_NONE | SIGHASH_ANYONECANPAY
SIGHASH_NONE implies that ...
0
votes
1
answer
255
views
How to generate the digest from a raw bitcoin transaction for verifying signature of specific input?
I'm writing a stand alone process that needs to verify that a known UTXO is part of a new transaction with a valid signature.
Inputs [ UTXO, raw transaction, input_number ]
How do to I verify the ...
4
votes
1
answer
576
views
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 ...
2
votes
1
answer
237
views
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 ...
1
vote
1
answer
311
views
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 ...
1
vote
1
answer
186
views
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 ...
4
votes
1
answer
332
views
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 ...
3
votes
1
answer
448
views
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:...
1
vote
1
answer
366
views
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.
...
9
votes
1
answer
276
views
What SIGHASH flags does CoinJoin use?
What SIGHASH flags are used when constructing a CoinJoin transaction?