Author

Topic: How can I verify ECDsa signature that I made? (Read 180 times)

legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
September 21, 2018, 08:21:51 AM
#6
then your length fields are screwed up.

YUP. That was it. Thanks.
I missed the fact that 47 (or the right one 48) is the size of the first stack Tongue I mistook it for a DER-length.

If I am not mistaken 48 should be a Compact size integer?
legendary
Activity: 2053
Merit: 1356
aka tonikt
September 21, 2018, 08:10:52 AM
#5
(there is an extra 01 in yours)

That is not "extra", that is sigHashType (01 for signall).

then your length fields are screwed up.

Code:
0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000006b483045022100c3835cd9615ad7bf13ce68498ca4262794f8e1b481020107234e99a675710b40022070cd0c818f53b937e308ce4a824e75657875b3dabeea2eb9e377f18efdeb86e901210250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352ffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
September 21, 2018, 08:07:12 AM
#4
(there is an extra 01 in yours)

That is not "extra", that is sigHashType (01 for signall).
An example tx from last block:
https://blockexplorer.com/api/rawtx/85478be31ee805af627562a4b30b44a3321acdf593fb72c99660065a0c7bf301
Quote
48
  30
  45
    02
    21
      008115527f88cf17c6a81ae98e5024ce9839faacba2c78d0005e7413be933397b4
    02
    20
      33792c5f9f76dae8346cab3e69a891101f65ec160bfaba823740a17784c38504
  01
21
  03f63338b081b576f9308066dd1b869eed6f999cff1f24620b416ea7b65fc4e8db
legendary
Activity: 2053
Merit: 1356
aka tonikt
September 21, 2018, 08:03:36 AM
#3
In your case the output script you need will probably be:
Code:
76a914f54a5851e9372b87810a8e60cdd2e7cfd80b6e3188ac

legendary
Activity: 2053
Merit: 1356
aka tonikt
September 21, 2018, 07:58:05 AM
#2
This doesn't seem to be a valid transaction.

I think you rather meant:
Code:
0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000006a473045022100c3835cd9615ad7bf13ce68498ca4262794f8e1b481020107234e99a675710b40022070cd0c818f53b937e308ce4a824e75657875b3dabeea2eb9e377f18efdeb86e9210250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352ffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000

(there is an extra 01 in yours)

Then to verify the signature you also need the output script from the transaction that you are spending:
Code:
TxID: f2b3eb2deb76566e7324307cd47c35eeb88413f971d88519859b1834307ecfec
VOut: 1
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
September 21, 2018, 07:37:02 AM
#1
I have been working on EC calculations, ECDsa signatures and DER-encoding, considering the randomness of the results and the fact that I am not using any kind of external libraries for any of the steps, I don't know how correct my resulting signatures are!

Lets take the transaction in this example with the following private key:
Code:
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

How can I verify whether the following transaction has a valid signature (ignore the fact that the transaction it is spending does not exist):
Code:
0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000006b473045022100c3835cd9615ad7bf13ce68498ca4262794f8e1b481020107234e99a675710b40022070cd0c818f53b937e308ce4a824e75657875b3dabeea2eb9e377f18efdeb86e901210250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352ffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000

I will try with TestNet coins later, but for now I would like to know which part I messed up (if any) for today.
Jump to: