Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: jl2012 on July 12, 2013, 04:28:26 PM



Title: Effect of different hashtypes
Post by: jl2012 on July 12, 2013, 04:28:26 PM
I would like to clarify the meaning of different hashtypes:

SIGHASH_ALL: All inputs and outputs are required.

SIGHASH_ALL + SIGHASH_ANYONECANPAY: All outputs are required. I don't care where the rest of bitcoins come from.

SIGHASH_NONE: All inputs are required. I don't care where the bitcoins go.

SIGHASH_NONE + SIGHASH_ANYONECANPAY: I don't care where the rest of bitcoins come from. I don't care where the bitcoins go. Basically throwing the coins away without any condition.

SIGHASH_SINGLE: All inputs are required. As long as one particular output is satisfied, I don't care where the rest of bitcoins go.

SIGHASH_SINGLE + SIGHASH_ANYONECANPAY: I don't care where the rest of bitcoins come from. As long as one particular output is satisfied, I don't care where the rest of bitcoins go.

Am I correct?

How is the particular output in SIGHASH_SINGLE specified? I don't understand the description in bitcoin wiki ( https://en.bitcoin.it/wiki/OP_CHECKSIG#Procedure_for_Hashtype_SIGHASH_SINGLE )


Title: Re: Effect of different hashtypes
Post by: blueadept on July 12, 2013, 04:35:14 PM
As I understand it, a) you're correct and b) the number of the output is the same as the number of the input when using SIGHASH_SINGLE.  So if your input is at position 0, the output you'd be including in the transaction hash would be output 0.


Title: Re: Effect of different hashtypes
Post by: Mike Hearn on July 12, 2013, 04:47:09 PM
There's a description here:

https://en.bitcoin.it/wiki/Contracts