Bitcoin Forum
May 08, 2024, 05:15:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Handiest way to verify a signature in isolation  (Read 876 times)
edmundedgar (OP)
Sr. Member
****
Offline Offline

Activity: 352
Merit: 250


https://www.realitykeys.com


View Profile WWW
June 21, 2014, 09:37:16 AM
 #1

So I've been hacking on bitcore.io trying to do some (hopefully not for much longer, Inshallah) non-standard transactions with it, and I'm finding they're getting rejected by my testnet node for being invalid. I can generate the same transactions with a python script I made earlier and get them accepted and mined OK, and the hash that's getting passed to the sign code seems to be the same in both cases, so I reckon I'm somehow screwing up the actual signature creation rather than elsewhere in the script, but I'd like to test the signatures in isolation to be sure and confirm that the ones getting created by my JavaScript are definitely wonky where the ones created by my Python code are good.

Any suggestions for an easy, hard-to-screw-up-when-sleep-deprived way to verify a signature in isolation? I'm wondering if I can do something like (made-up options follow):
Code:
openssl --i-would-like-to-verify-a-signature-please --ecdsa-something-or-other <pubkey> <hash_that_gets_passed_in_for_signing> <signature>
1715145345
Hero Member
*
Offline Offline

Posts: 1715145345

View Profile Personal Message (Offline)

Ignore
1715145345
Reply with quote  #2

1715145345
Report to moderator
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
dexX7
Legendary
*
Offline Offline

Activity: 1106
Merit: 1024



View Profile WWW
June 21, 2014, 06:19:37 PM
 #2

Probably not exatly what you are looking for, but you may could give python-bitcoinlib a try:

https://github.com/petertodd/python-bitcoinlib/blob/master/examples/spend-pay-to-script-hash-txout.py

12648430
Full Member
***
Offline Offline

Activity: 144
Merit: 100


View Profile
June 21, 2014, 06:49:07 PM
 #3

bitcoind has some unit tests that are exactly what you want; you could copy one, put in your own values, and run it as a bitcoind test. You could do it with openssl but you'd probably need to convert the pubkey into an openssl-compatible format somehow.
edmundedgar (OP)
Sr. Member
****
Offline Offline

Activity: 352
Merit: 250


https://www.realitykeys.com


View Profile WWW
June 26, 2014, 07:21:45 AM
 #4

Thanks for the suggestions. I ended up doing it the other way: Instead of verifying the signatures my JavaScript was emitting, I plugged in a couple of signatures for the same transaction from my Python code to prove that the rest of the JavaScript was OK and figured it out that way. (Seems like my signatures were OK but I had them in the wrong order, which results in OP_CHECKMULTISIG reporting an invalid signature???)
Aleksei Richards
Newbie
*
Offline Offline

Activity: 38
Merit: 0



View Profile
June 26, 2014, 01:16:39 PM
 #5

Thanks for the suggestions. I ended up doing it the other way: Instead of verifying the signatures my JavaScript was emitting, I plugged in a couple of signatures for the same transaction from my Python code to prove that the rest of the JavaScript was OK and figured it out that way. (Seems like my signatures were OK but I had them in the wrong order, which results in OP_CHECKMULTISIG reporting an invalid signature???)

Yes you do need them in the correct order as I've just found out.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!