Questions tagged [sighash-flags]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Which SIGHASH type we have to append at the end of the trimmed transaction in OP_CHECKSIG

how to know which sighash type we have to append to the trimmed transaction at the time of input scripts verification, take referance from the below example { "version": 2, "locktime&...
lladane's user avatar
  • 13
1 vote
2 answers
281 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,...
Denys Malovanyi's user avatar
1 vote
1 answer
132 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 ...
pbies's user avatar
  • 149
1 vote
1 answer
231 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 ...
dassd's user avatar
  • 1,069
6 votes
0 answers
149 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 ...
Vojtěch Strnad's user avatar
6 votes
1 answer
403 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 ...
Zephyrus's user avatar
  • 772
1 vote
1 answer
144 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 ...
Zephyrus's user avatar
  • 772
5 votes
1 answer
359 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?
JordanPedersenCommitments's user avatar
1 vote
2 answers
403 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 ...
ddavi031's user avatar
  • 479
0 votes
1 answer
54 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 ...
Darius's user avatar
  • 789
1 vote
1 answer
351 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 ...
Darius's user avatar
  • 789
7 votes
1 answer
1k 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 ...
Ugam Kamat's user avatar
  • 7,408
0 votes
1 answer
137 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 ...
nick carraway's user avatar
0 votes
1 answer
276 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 ...
jaybny's user avatar
  • 173
4 votes
1 answer
595 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 ...
pinhead's user avatar
  • 5,144
2 votes
1 answer
246 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 ...
Roy Tang's user avatar
  • 121
1 vote
1 answer
330 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 ...
yrm23's user avatar
  • 51
1 vote
1 answer
189 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 ...
sr_gi's user avatar
  • 3,220
4 votes
1 answer
358 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 ...
pinhead's user avatar
  • 5,144
3 votes
1 answer
452 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:...
Adam Langsner's user avatar
1 vote
1 answer
383 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. ...
Alessandro Polverini's user avatar
9 votes
1 answer
285 views

What SIGHASH flags does CoinJoin use?

What SIGHASH flags are used when constructing a CoinJoin transaction?
Nick ODell's user avatar
  • 29.4k