Title: Why the end of signatures is 0x01 Post by: zzkjliu on March 10, 2014, 03:37:09 PM Hello all!
If you look at this transaction(http://blockexplorer.com/rawtx/d2b04f28dfe36bbd7f6228519725f4560b6d7eef0eb9c1b1d4c718f2ba4548f5 (http://blockexplorer.com/rawtx/d2b04f28dfe36bbd7f6228519725f4560b6d7eef0eb9c1b1d4c718f2ba4548f5)) you can see that one of the signatures is: Code: 3045 0220 Why the end of the character is 0x01? Title: Re: Why the end of signatures is 0x01 Post by: btchip on March 10, 2014, 03:44:03 PM It's the hashtype, which is not part of the signature - check https://en.bitcoin.it/wiki/OP_CHECKSIG
Title: Re: Why the end of signatures is 0x01 Post by: zzkjliu on March 10, 2014, 04:07:48 PM It's the hashtype, which is not part of the signature - check https://en.bitcoin.it/wiki/OP_CHECKSIG You are wrong? hashtype is 4 bytes, and in the TxOut. But the 0x01 is in the scriptSig in TxIn Code: Hashtype Values (from script.h): Title: Re: Why the end of signatures is 0x01 Post by: DannyHamilton on March 10, 2014, 08:44:50 PM It's the hashtype, which is not part of the signature - check https://en.bitcoin.it/wiki/OP_CHECKSIG You are wrong? hashtype is 4 bytes, and in the TxOut. But the 0x01 is in the scriptSig in TxIn Code: Hashtype Values (from script.h): Does step 5 here answer your question? https://en.bitcoin.it/w/images/en/7/70/Bitcoin_OpCheckSig_InDetail.png Title: Re: Why the end of signatures is 0x01 Post by: zzkjliu on March 11, 2014, 12:24:00 AM Thanks Title: Re: Why the end of signatures is 0x01 Post by: kjj on March 11, 2014, 11:50:17 AM It will probably be many, many years before we see a three byte hashtype. Edit (2014-03-11): Totally wrong, see next post Title: Re: Why the end of signatures is 0x01 Post by: Peter Todd on March 11, 2014, 12:51:59 PM It is a varint (https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer). For values between 0 and 253, a varint has a single byte representation. It will probably be many, many years before we see a three byte hashtype. That's incorrect; from CheckSig(): Code: if (nHashType == 0) vchSig is a vector of 8-bit unsigned char's, so it really is just a single byte and encoding a varint would cause the signature to fail. In particular, changing to that in the future would not be a backwards compatible change. Title: Re: Why the end of signatures is 0x01 Post by: kjj on March 11, 2014, 02:29:44 PM Shit, you're right. I should have checked the source instead of my notes.
Title: Re: Why the end of signatures is 0x01 Post by: zzkjliu on March 11, 2014, 03:49:02 PM Look at this:https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
Code: https://en.bitcoin.it/wiki/OP_CHECKSIG which is always "1", is this right? |