Author

Topic: [Closed] Help generating segwit txcopy for signature verification (Read 472 times)

hero member
Activity: 793
Merit: 1026
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.
staff
Activity: 3458
Merit: 6793
Just writing some code
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?
hero member
Activity: 793
Merit: 1026
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.
Jump to: