Bitcoin Forum
April 25, 2024, 08:55:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: where can i find examples of transactions with different SIGHASH types?  (Read 192 times)
BrewMaster (OP)
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
August 07, 2019, 07:08:27 AM
Merited by BlackBaron (1)
 #1

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?

There is a FOMO brewing...
1714035312
Hero Member
*
Offline Offline

Posts: 1714035312

View Profile Personal Message (Offline)

Ignore
1714035312
Reply with quote  #2

1714035312
Report to moderator
1714035312
Hero Member
*
Offline Offline

Posts: 1714035312

View Profile Personal Message (Offline)

Ignore
1714035312
Reply with quote  #2

1714035312
Report to moderator
1714035312
Hero Member
*
Offline Offline

Posts: 1714035312

View Profile Personal Message (Offline)

Ignore
1714035312
Reply with quote  #2

1714035312
Report to moderator
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Pmalek
Legendary
*
Offline Offline

Activity: 2744
Merit: 7095



View Profile
August 07, 2019, 08:43:23 AM
Merited by BrewMaster (2)
 #2

A search led me to this: https://en.bitcoin.it/wiki/Contract
Source: https://bitcointalk.org/index.php?topic=31264.0

And here is another thread discussing SIGHASH types for multisig. https://bitcointalk.org/index.php?topic=1383883.0
Maybe you can will some useful info there if you haven't checked it out yet.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
darosior
Sr. Member
****
Offline Offline

Activity: 279
Merit: 435


View Profile
August 07, 2019, 04:53:55 PM
Merited by nc50lc (2), BrewMaster (2), ABCbits (1), hugeblack (1), BlackBaron (1)
 #3

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.
BrewMaster (OP)
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
August 08, 2019, 01:16:12 PM
 #4

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.

There is a FOMO brewing...
darosior
Sr. Member
****
Offline Offline

Activity: 279
Merit: 435


View Profile
August 09, 2019, 01:41:45 PM
 #5

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 ;-)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!