I'm attempting to use
this picture to transform a tx in order to manually verify the signature.
The tx I'm working on is 60b20eca2285b7ed8b64a1f98277c16fcc205b9e21413d6a72545880d2a3f341, which is the full signed tx of:
010000000217cbf067a9ad71b2f69ea66a1c94d04cee26f856b5b4bdccaeccb59761419668010000008a4730440220735364aea32db724e7f0179f48e4ad5a63a3b04f733e82ca5215097a91aa7123022015846041c9564ff96fb269cb5e9b2f24dac003299e5d16d34fb9c699d55825c7014104617f9e26b7f6f776e30cb4aa24ebef9e183caf6da25684862a32446589be20a53c2b37a7283430033bdfd2f31a96edaea88bf9ebf07498476cb34d16b47887edffffffff877a5dd62eab9f1fd28739a9ae7c68fcb0f075b2c2ede13cb3acff15d362e271010000008c493046022100d0af9e17b678ad7823ad331a04d5b50f2dc173715949718ef974314f9ddbf0fa02210098de23b9c6daad57e7c8a8748718c56ec8d20cd2686aa652c4fb85091a39c690014104617f9e26b7f6f776e30cb4aa24ebef9e183caf6da25684862a32446589be20a53c2b37a7283430033bdfd2f31a96edaea88bf9ebf07498476cb34d16b47887edffffffff01709cc901000000001976a914ea0fcd06c9c62e590a8975627d0165b514568a5a88ac00000000
After some research, I've been able to break down the entire tx:
01000000 - byte_reverse(Version: 1, in hex, 4 bytes long)
02 - Total number of inputs (starts at 1, not 0, so for this tx there are 2 total inputs not three)
17cbf067a9ad71b2f69ea66a1c94d04cee26f856b5b4bdccaeccb59761419668 - byte_reverse(input_txid)
01000000 - byte_reverse of vout num for prev_tx (starting at 0, so this is the second output from that tx)
8a - total byte length (in hex, 0x8a = 138) of following signature + pubkey, (plus prefix bytes to indicate length)
47 - total byte length (0x47 = 71) of following signature
30 - DER encoded signature
44 - total byte length of following signature info
02 - first value is an integer, represented in hex (DER format calls that 0x02 apparently)
20 - byte length of first value (0x20 = 32 in decimal)
735364aea32db724e7f0179f48e4ad5a63a3b04f733e82ca5215097a91aa7123 - r value (pub X coord of random nonce)
02 - next number is also an int
20 - next data is 32 bytes long
15846041c9564ff96fb269cb5e9b2f24dac003299e5d16d34fb9c699d55825c7 - s value (signature for nonce,data,privkey tuple)
01 - bitcoin signature type SIGHASH_ALL
(tells miners how to verify signature. some sig types sign only certain inputs or outputs, like in coinjoin tx's. the standard SIGHASH_ALL signs the entire tx so no modifications can be made)
41 - byte length of following public key (0x41=65)
04617f9e26b7f6f776e30cb4aa24ebef9e183caf6da25684862a32446589be20a53c2b37a7283430033bdfd2f31a96edaea88bf9ebf07498476cb34d16b47887ed - pubkey which is the key for the input address and which corresponds to the privkey used to make sig
ffffffff - sequence number, assigned just now in this tx, to this last input, for use with nlocktime in this tx
877a5dd62eab9f1fd28739a9ae7c68fcb0f075b2c2ede13cb3acff15d362e271 - second input byte_reverse(tx_id)
01000000 - second input byte_reversed vout number. (again, starting at 0, so this is the second output)
8c - length of full signature and pubkey
49 - length of following signature info
30 - DER encoded signature
46 - length of following signature info
02 - first number is der int
21 - length of first number data plus 00 prefix
00 - I'm unclear about what this is or why it's here or if it's necessary
d0af9e17b678ad7823ad331a04d5b50f2dc173715949718ef974314f9ddbf0fa - r value
02 - next number is int
21 - length of next number and 00 prefix
00 - again, no clue
98de23b9c6daad57e7c8a8748718c56ec8d20cd2686aa652c4fb85091a39c690 - s value
01 - SIGHASH_ALL
41 - length of following pubkey
04617f9e26b7f6f776e30cb4aa24ebef9e183caf6da25684862a32446589be20a53c2b37a7283430033bdfd2f31a96edaea88bf9ebf07498476cb34d16b47887ed - pubkey for prevtx vout, which should be the same one used for the signature
ffffffff - sequence number assigned to input
01 - total number of outputs, in hex, starting at 1 not 0.
709cc90100000000 - byte_reverse of (number of satoshis in output represented in hex), zfilled to 8 bytes long
19 - number of bytes for output script
76 - OP_DUP, duplicated previous stack data (which will be the hash160 when this script is used to spend the money)
a9 - OP_HASH160, the ripemd160(sha250(pubkey)) for the output key
14 - length of the hash160 data
ea0fcd06c9c62e590a8975627d0165b514568a5a - hash160 of address's public key
88 - OP_EQUALVERIFY, does OP_EQUAL which puts TRUE on the stack if sig is valid
then does OP_VERIFY which stops the transaciton and marks it invalid if the top stack item is not TRUE
ac - OP_CHECKSIG, makes sure the data that has a valid sig is actually this tx's data.
00000000 - nlocktime
And using the pic I linked to above, as well as
this page and
this page, I've attempted to create what the picture link calls "verifyThisStr", replacing the scriptsig with the previous tx scriptpubkey:
010000000217cbf067a9ad71b2f69ea66a1c94d04cee26f856b5b4bdccaeccb59761419668010000001976a9140a2217742759c9951371083564d94b8b0317528488acffffffff877a5dd62eab9f1fd28739a9ae7c68fcb0f075b2c2ede13cb3acff15d362e271010000001976a9140a2217742759c9951371083564d94b8b0317528488acffffffff01709cc901000000001976a914ea0fcd06c9c62e590a8975627d0165b514568a5a88ac0000000001000000
However, the double hash for that is 6379ec988e87a690521a2bafe96fd035fc28ad451f3d1b65bf80d25bdb322057, which does not pass signature verification.
I was hoping somebody could point out the error in my unsigned tx "verifyThisStr", so that I can manually verify the tx.
Thanks for the help everybody!!!