Bitcoin Forum
August 24, 2019, 10:19:46 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: where can i find examples of transactions with different SIGHASH types?  (Read 112 times)
BrewMaster
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 776


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?

1566641986
Hero Member
*
Offline Offline

Posts: 1566641986

View Profile Personal Message (Offline)

Ignore
1566641986
Reply with quote  #2

1566641986
Report to moderator
1566641986
Hero Member
*
Offline Offline

Posts: 1566641986

View Profile Personal Message (Offline)

Ignore
1566641986
Reply with quote  #2

1566641986
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Pmalek
Legendary
*
Offline Offline

Activity: 1036
Merit: 1132



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.

████████████████████████████
████████▀▀ █▀ █▀ ▀██████████
█████████▄ ▄▄▄▄▄▄███████████
██████████▀     ▀  ▀████████
███████▀ ▀  ▄█▀▀▀█▀▀████████
██████▄      █▄  ▀▀  ▀██████
██████         ▄▄█▄ ▄ ▀█████
█████ ▄         ▀▀ ▄ ▀ █████
██████▌          █▀█▀ ▐█████
███████  ▄▌         ▄ ██████
████████▄█         ▄████████
█████████▀     ▄▄ ▄█████████
████████████████████████████
.JACKMATE'S...........
.
MAJESTIC..
████████████████████████
███████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
████████████████████████
.
..WIN 1 BITCOIN ON EVERY PREMIER LEAGUE MATCHDAY..
████████████████████████████████
████████████▀█▀ ▀█▀█▀███████████
███████████▄ ▄▄▄▄▄▄▄████████████
███████████▀▀▄▄▄▄▄▄▄▄███████████
█████████▀▄ ██▀▄▄▄ ▀ ▄▀█████████
███████▀ ▀█████▄▄▄█▄▄▄██████████
███████▀▄████████▀  ▀█ █▐███████
███████ ▀█████████▄█▀▀██ ███████
████████ ███▀██████ ▄ ██ ███████
████████▌▐▀▄ ██████████ ▄███████
█████████▄██▌▐█████▀██ █████████
████████████▄▀▀▀▀▀▄ ▀▄██████████
████████████████████████████████
.
.JOIN US - IT'S FREE! .
darosior
Full Member
***
Offline Offline

Activity: 178
Merit: 195



View Profile WWW
August 07, 2019, 04:53:55 PM
Merited by BrewMaster (2), nc50lc (2), ETFbitcoin (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.

Github profile ~ Crypto Lyon (french community)  ~ GPG key fingerprint : E13F C145 CD3F 430 ~ LN public key : 03678b4f041fbfbeebcafc076469df75decf81da20a53bd490172e83ce532df1fa
BrewMaster
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 776


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.

darosior
Full Member
***
Offline Offline

Activity: 178
Merit: 195



View Profile WWW
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 ;-)

Github profile ~ Crypto Lyon (french community)  ~ GPG key fingerprint : E13F C145 CD3F 430 ~ LN public key : 03678b4f041fbfbeebcafc076469df75decf81da20a53bd490172e83ce532df1fa
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!