The follow is a huge post, and I'm sorry. I just wanted to make sure all the steps were right.
Okay, so this is my attempt at following the instructions for the sample.
Step 1 is not relevant.
Setp 2 A new subscript is created from the instruction from the most recently parsed OP_CODESEPARATOR (last one in script) to the end of the script. If there is no OP_CODESEPARATOR the entire script becomes the subscript (hereby referred to as subScript)
This is the previous output script, found in block 9:
410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC
breaking that down is:
41 = bytes to push onto the stack
04 = uncompressed public key
11DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5C = x
B2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3A = y
AC = OP_CHECKSIG
there is no OP_CODESEPARATOR, so the whole thing becomes subscript.
step 3 The sig is deleted from subScript. not applicable.
step 4 All OP_CODESEPARATORS are removed from subScript. again, not applicable because there is none.
step 5 The hashtype is removed from the last byte of the sig and stored. The full signature is
304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901
so the last byte is 01, reversed it’s 01000000.
step 6 A copy is made of the current transaction (hereby referred to txCopy)
so here is the full raw transaction:
0100000001C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD3704000000004847304402204E45E16932B8AF514961A1D3A1A25FDF3F4F7732E9D624C6C61548AB5FB8CD410220181522EC8ECA07DE4860A4ACDD12909D831CC56CBBAC4622082221A8768D1D0901FFFFFFFF0200CA9A3B00000000434104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC00286BEE0000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC00000000
I know the above is correct raw value because if you hash it twice, you get the correct hash
169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4
broken down:
01000000 = version
01 = number of inputs
C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD3704 = previous hash
00000000 = index of previous hash
48 = script length, 72 bytes
47304402204E45E16932B8AF514961A1D3A1A25FDF3F4F7732E9D624C6C61548AB5FB8CD4102201
81522EC8ECA07DE4860A4ACDD12909D831CC56CBBAC4622082221A8768D1D0901 = script
FFFFFFFF = sequence
02 = out count
00CA9A3B00000000 = out value
43 = script length.
4104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F
554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC
00286BEE00000000 = out value
43 = script length
410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB8
4CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC
00000000 = locktime
//step 7 The scripts for all transaction inputs in txCopy are set to empty scripts (exactly 1 byte 0x00)
0100000001C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD37040000000000FFFFFFFF0200CA9A3B00000000434104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC00286BEE0000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC00000000
broken down:
01000000 = version
01 = number of inputs
C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD3704 = previous hash
00000000 = index of previous hash
00 = script length (I’m a little confused here. Should there be another zero after this?)
FFFFFFFF = sequence
02 = outcount
00CA9A3B00000000 = out value
43 = script length
4104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F
554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC
00286BEE00000000 = value
43 = script length
410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB8
4CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC = script
00000000 = lock time
step 8 The script for the current transaction input in txCopy is set to subScript (lead in by its length as a var-integer encoded!)
0100000001C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD37040000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3ACFFFFFFFF0200CA9A3B00000000434104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC00286BEE0000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC00000000
broken down:
01000000
01
C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD3704
00000000 = index of previous hash
43 = new script length
410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB8
4CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC = new subscript
FFFFFFFF = sequence
02 = number of outputs
00CA9A3B00000000 = out value
43 = length
4104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F
554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC = script
00286BEE00000000 = out value
43 = length
410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB8
4CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC = script
00000000
step 9 An array of bytes is constructed from the serialized txCopy appended by four bytes for the hash type. This array is sha256 hashed twice, then the public key is used to check the supplied signature against the hash.
0100000001C997A5E56E104102FA209C6A852DD90660A20B2D9C352423EDCE25857FCD37040000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3ACFFFFFFFF0200CA9A3B00000000434104AE1A62FE09C5F51B13905F07F06B99A2F7159B2225F374CD378D71302FA28414E7AAB37397F554A7DF5F142C21C1B7303B8A0626F1BADED5C72A704F7E6CD84CAC00286BEE0000000043410411DB93E1DCDB8A016B49840F8C53BC1EB68A382E97B1482ECAD7B148A6909A5CB2E0EADDFB84CCF9744464F82E160BFA9B8B64F9D4C03F999B8643F656B412A3AC0000000001000000
the above hash’ed twice and becomes the message to verify:
7a05c6145f10101e9d6325494245adf1297d80f8f38d4d576d57cdba220bcb19
the signature
304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901
It does not verify.
I know that was a lot to look over, I’m sorry. Anybody notice where I went wrong?