Bitcoin Forum
December 17, 2017, 05:05:36 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [Closed] Help generating segwit txcopy for signature verification  (Read 370 times)
luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 793



View Profile
September 07, 2016, 04:20:31 PM
 #1

Using this guide, and the segwit BIP, I feel like I'm reasonably comfortable constructing and verifying transactions in the new segwit format.  Except for the life of me, I cannot figure out how to format the transaction to the format that gets hashed for the signature.  Can somebody help me out and paste the txcopy for the example transaction in the link, so I can see where my error was.  I have no trouble making txcopies for non-segwit transactions, and I'm not sure what I'm doing wrong here.  (And also, maybe somebody can tell me what changes are needed, given that the example uses a P2SH-wrapped segwit output.)

Thanks for the help guys!

EDIT:  I just now found out that BIP 143 exists and explains exactly my problem.

1513487136
Hero Member
*
Offline Offline

Posts: 1513487136

View Profile Personal Message (Offline)

Ignore
1513487136
Reply with quote  #2

1513487136
Report to moderator
1513487136
Hero Member
*
Offline Offline

Posts: 1513487136

View Profile Personal Message (Offline)

Ignore
1513487136
Reply with quote  #2

1513487136
Report to moderator
1513487136
Hero Member
*
Offline Offline

Posts: 1513487136

View Profile Personal Message (Offline)

Ignore
1513487136
Reply with quote  #2

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

Activity: 1246


17kKQppUsngUiByDsce4JXoZEjjpvX9bpR


View Profile WWW
September 07, 2016, 04:22:43 PM
 #2

So you want the actual input to the hashing functions before the signing? Read the BIP, it explains it pretty well.

Also, can you post what you think is right so that we can see what you have done wrong?

luv2drnkbr
Hero Member
*****
Offline Offline

Activity: 793



View Profile
September 07, 2016, 05:48:46 PM
 #3

So you want the actual input to the hashing functions before the signing?

Yes, that would be extremely helpful.

Read the BIP, it explains it pretty well.

I could not find anything about signature verification, barring the change in transaction serialization format.

Also, can you post what you think is right so that we can see what you have done wrong?

I have tried formatting it in almost every imaginable way.  With and without the segwit marker and flag, with the segwit script hash in the scriptsig area, with the redeem script in the scriptsig area, with and without the redeem script in the witness field after the output, with and without the witness script in the witness field, and every combination of mixing and matching of all of those.  (Including with and without the SIGHASH_ALL 8-byte flag at the end.)

That's why I was hoping to just have somebody who knows better post what the actual txcopy should be.  It will be immediately obvious what I should or should not have done if I can see the correct serialized txcopy.

EDIT:  I just now found out that BIP 143 exists and explains exactly my problem.

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!