I refer to this site How to redeem a basic Tx?

  1. (signing stage) Now we double-SHA256 hash this entire structure, which yields the hash 9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e

  2. We then create a public/private key pair out of the provided private key. We sign the hash from step 14 with the private key, which yields the following DER-encoded signature (this signature will be different in your case): 30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06 To this signature we append the one-byte hash code type: 01. The public key is: 0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6

I try to verify whether the message is correct

The message is 9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e, The public key is mfcSEPR8EkJrpX91YkTJ9iscdAzppJrG9j, and The signature is 30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06

However, when I verify it on http://www.coinig.com/, signature is wrong. Why is it so? Thank you

1 Answer 1


The signature is actually correct. However something may be going on with the tool, either you are introducing the parameters in an unexpected format or the tool is not properly working (I haven't been able to verify the signature using the tool either).

Here you have some simple code that uses VButerin's Bitcoin tools python library and verifies that the signature is correct:

from bitcoin import ecdsa_tx_verify

unsigned_tx = "0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000001976a914010966776006953d5567439e5e39f86a0d273bee88acffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000"
sig = "30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc0601"  # WITH SIG_FLAG
pk = "0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6"
sig_flag = 1  #SIGHASH_ALL

print ecdsa_tx_verify(unsigned_tx, sig, pk, sig_flag)

That outputs:


Notice that unsigned_tx has been built using all the field from Step 13 but the very last one, that corresponds to the hashtype (4 bytes, 01000000). sig corresponds to the signature adding the hashtype (1 byte, 01), and the pk (public key) corresponds to the one given in Step 15.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.