Bitcoin Forum
May 13, 2024, 06:36:29 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Closed] Help generating segwit txcopy for signature verification  (Read 457 times)
luv2drnkbr (OP)
Hero Member
*****
Offline Offline

Activity: 793
Merit: 1016



View Profile
September 07, 2016, 04:20:31 PM
Last edit: September 07, 2016, 05:53:52 PM by luv2drnkbr
 #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.

1715582189
Hero Member
*
Offline Offline

Posts: 1715582189

View Profile Personal Message (Offline)

Ignore
1715582189
Reply with quote  #2

1715582189
Report to moderator
1715582189
Hero Member
*
Offline Offline

Posts: 1715582189

View Profile Personal Message (Offline)

Ignore
1715582189
Reply with quote  #2

1715582189
Report to moderator
1715582189
Hero Member
*
Offline Offline

Posts: 1715582189

View Profile Personal Message (Offline)

Ignore
1715582189
Reply with quote  #2

1715582189
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715582189
Hero Member
*
Offline Offline

Posts: 1715582189

View Profile Personal Message (Offline)

Ignore
1715582189
Reply with quote  #2

1715582189
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


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 (OP)
Hero Member
*****
Offline Offline

Activity: 793
Merit: 1016



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:  

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