Author

Topic: where can i find examples of transactions with different SIGHASH types? (Read 191 times)

sr. member
Activity: 279
Merit: 435
What would you want to see added ?

i was hoping more for actual examples of the actual serialization (the bytes) that are signed when sighashtype is a different thing than ALL.
maybe something like this: https://bitcoin.stackexchange.com/questions/32628/redeeming-a-raw-transaction-step-by-step-example-required
I completely understand you Cheesy I actually used the answer to this question (and some bitcoin-core code) to do the script I linked you above.

the contract page on wiki helped a lot though. and i had a mistake thinking different sighashtypes were used for certain output types not just anything. reading these links that were provided and looking at some code i think i understand it better now.
i just have to debug some code to see what happens under the hood to fill in some gaps.
Great, don't hesitate if you have other questions I may have already looked for (and hopefully found) an answer to them ;-)
legendary
Activity: 2128
Merit: 1293
There is trouble abrewing
What would you want to see added ?

i was hoping more for actual examples of the actual serialization (the bytes) that are signed when sighashtype is a different thing than ALL.
maybe something like this: https://bitcoin.stackexchange.com/questions/32628/redeeming-a-raw-transaction-step-by-step-example-required

the contract page on wiki helped a lot though. and i had a mistake thinking different sighashtypes were used for certain output types not just anything. reading these links that were provided and looking at some code i think i understand it better now.
i just have to debug some code to see what happens under the hood to fill in some gaps.
sr. member
Activity: 279
Merit: 435
About the title here are transaction example with different SIGHASHes : https://github.com/petertodd/python-bitcoinlib/blob/05cbb3c9560b36cfe71bac06085a231a6244e13a/bitcoin/tests/data/tx_valid.json#L39

i have been learning more about how transactions are signed and already finished all output types but all with SIGHASH_ALL. i feel like all the documentations are lacking when it comes to different SIGHASH types.
I've found https://en.bitcoin.it/wiki/OP_CHECKSIG quite exhaustive when learning about sighashes (especially the image at the right). What would you want to see added ?

are transactions signed with these types even final/valid?
what is the scriptpub of the outputs they are signing?
The sighash is put aside the signature to be able to verify it : you need to know which data was signed in order to be able to verify the signature against this data. This we want to sign the transaction we are putting the signature in, the SIGHASH (represented as a single byte) is kind of a metadata indicating which part of the transaction has been signed.

EDIT: This is tweakings but it might help you to understand, here is the permalink to the line where the sighash is appended in a transaction signing function in some (dirty) script I wrote. You might be able to find a more clean version on Peter Todd's python-bitcoinlib.
legendary
Activity: 2730
Merit: 7065
A search led me to this: https://en.bitcoin.it/wiki/Contract
Source: https://bitcointalksearch.org/topic/other-sighash-types-31264

And here is another thread discussing SIGHASH types for multisig. https://bitcointalksearch.org/topic/sighash-precedence-for-multisig-1383883
Maybe you can will some useful info there if you haven't checked it out yet.
legendary
Activity: 2128
Merit: 1293
There is trouble abrewing
i have been learning more about how transactions are signed and already finished all output types but all with SIGHASH_ALL. i feel like all the documentations are lacking when it comes to different SIGHASH types.

bitcoin.org has a "transaction guide" that explains what is signed with each type but i can not find any actual examples anywhere to understand what it means and see it on an actual transaction on the blockchain.

are transactions signed with these types even final/valid?
what is the scriptpub of the outputs they are signing?
Jump to: