zzkjliu (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
March 10, 2014, 03:37:09 PM Last edit: March 10, 2014, 04:01:38 PM by zzkjliu |
|
Hello all! If you look at this transaction( http://blockexplorer.com/rawtx/d2b04f28dfe36bbd7f6228519725f4560b6d7eef0eb9c1b1d4c718f2ba4548f5) you can see that one of the signatures is: 3045 0220 316eb3cad8b66fcf1494a6e6f9542c3555addbf337f04b62bf4758483fdc881d this is r 022100 bf46d26cef45d998a2cb5d2d0b8342d70973fa7c3c37ae72234696524b2bc812 this is s 01
"scriptSig":"30450220316eb3cad8b66fcf1494a6e6f9542c3555addbf337f04b62bf4758483fdc881d022100bf46d26cef45d998a2cb5d2d0b8342d70973fa7c3c37ae72234696524b2bc81201"
Why the end of the character is 0x01?
|
|
|
|
|
|
|
|
|
"There should not be any signed int. If you've found a signed int
somewhere, please tell me (within the next 25 years please) and I'll
change it to unsigned int." -- Satoshi
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
|
|
zzkjliu (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
March 10, 2014, 04:07:48 PM |
|
You are wrong? hashtype is 4 bytes, and in the TxOut. But the 0x01 is in the scriptSig in TxIn Hashtype Values (from script.h): Name Value SIGHASH_ALL 0x00000001 SIGHASH_NONE 0x00000002 SIGHASH_SINGLE 0x00000003 SIGHASH_ANYONECANPAY 0x00000080
|
|
|
|
DannyHamilton
Legendary
Offline
Activity: 3388
Merit: 4653
|
|
March 10, 2014, 08:44:50 PM |
|
You are wrong? hashtype is 4 bytes, and in the TxOut. But the 0x01 is in the scriptSig in TxIn Hashtype Values (from script.h): Name Value SIGHASH_ALL 0x00000001 SIGHASH_NONE 0x00000002 SIGHASH_SINGLE 0x00000003 SIGHASH_ANYONECANPAY 0x00000080 Does step 5 here answer your question? https://en.bitcoin.it/w/images/en/7/70/Bitcoin_OpCheckSig_InDetail.png
|
|
|
|
zzkjliu (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
March 11, 2014, 12:24:00 AM |
|
Thanks
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1025
|
|
March 11, 2014, 11:50:17 AM Last edit: March 11, 2014, 02:30:58 PM by kjj |
|
It is a varint. 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.Edit (2014-03-11): Totally wrong, see next post
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
Peter Todd
Legendary
Offline
Activity: 1120
Merit: 1150
|
|
March 11, 2014, 12:51:59 PM |
|
It is a varint. 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(): if (nHashType == 0) nHashType = vchSig.back(); else if (nHashType != vchSig.back()) return false; vchSig.pop_back();
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.
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1025
|
|
March 11, 2014, 02:29:44 PM |
|
Shit, you're right. I should have checked the source instead of my notes.
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
zzkjliu (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
March 11, 2014, 03:49:02 PM Last edit: March 11, 2014, 04:01:09 PM by zzkjliu |
|
Look at this:https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 https://en.bitcoin.it/wiki/OP_CHECKSIG Hashtype Values (from script.h): Name Value SIGHASH_ALL 0x00000001 SIGHASH_NONE 0x00000002 SIGHASH_SINGLE 0x00000003 SIGHASH_ANYONECANPAY 0x00000080
https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 Enochian said "......, A signature is a pair of bignum integers, (r,s), so it consists of 0x30, which indicates a sequence of one or more things, an octet count of what follows, followed by two encoded integers. In addition, bitcoin appends the hashtype, which is always "1", to the end. ......" which is always "1", is this right?
|
|
|
|
|