Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: themgp on June 02, 2013, 12:13:18 AM



Title: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 02, 2013, 12:13:18 AM
If I have a Bitcoin address and a message signed with the private key of that address, is there a way to verify the signature with standard Unix commands?


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: jackjack on June 02, 2013, 12:18:10 AM
Is a python script (no dependency) ok to use?


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 02, 2013, 12:23:23 AM
Is a python script (no dependency) ok to use?

Yeah, i'm actually looking to do it in Ruby, but i'm guessing i can convert what is thrown at me to my language of choice. :)


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: jackjack on June 02, 2013, 12:33:38 AM
This is the Bitcoin signature/verification module I made for Armory:
https://github.com/jackjack-jj/jasvet/blob/master/jasvet.py

The function you're looking for is verify_message_Bitcoin(address, signature, message), line 387
Example:
  • address: 13C5HZKutjMDeuc7f5mPj6XGpJCZu7xKh2
  • signature: H55JIuwEi4YXzINOzx2oU6VsfBcTOScpFtp10pP/M4EWV336ClH65SObwPXnRf/fMXDu8hs8nweB42CtpWgngeM=
  • message: aaa

Feel free to ask me anything that isn't clear


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 02, 2013, 12:52:29 AM
From a fairly quick skim through the code, it looks pretty straight forward as written (hahah, though a little more complex than I was hoping!).  The rest of my weekend might be making a Ruby Gem for this. :)

Do you have tests for this?  I'd love to duplicate some of the tests also.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 02, 2013, 01:25:48 AM
Just noticed some tests at the bottom: https://github.com/jackjack-jj/jasvet/blob/master/jasvet.py#L551-L579


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 02, 2013, 09:35:32 AM
I released a Ruby Gem to verify signatures. More information:

https://github.com/michaelgpearce/bitcoin-cigs

https://bitcointalk.org/index.php?topic=223426


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: Raoul Duke on June 10, 2013, 04:51:41 PM
Any kind sould will do it in php?  ;D


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: piotr_n on June 10, 2013, 05:44:53 PM
You can also have a look at a tool called versigmsg, from my gocoin project.
https://github.com/piotrnar/gocoin/blob/master/tools/versigmsg.go

If you build it, it end up as a single executable, about 2MB big.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 11, 2013, 02:18:28 AM
Any kind sould will do it in php?  ;D

Put up a bounty.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: scintill on June 11, 2013, 05:14:31 AM
I made a standalone C++ tool based on stripped-down bitcoin reference source.  Just depends on OpenSSL.  It should be easy to integrate into any language that can spawn another process and receive its return code, although a native library would probably be better if that's available to you.  https://github.com/scintill/bitcoin-signature-tools

I just added a php demo: https://github.com/scintill/bitcoin-signature-tools/blob/master/tests/verifymessage.php

I would do it in native PHP (a bignum extension required) with this ECC library (https://github.com/mdanter/phpecc) for a bounty if anyone's interested.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: Raoul Duke on June 11, 2013, 09:08:24 AM
I would do it in native PHP (a bignum extension required) with this ECC library (https://github.com/mdanter/phpecc) for a bounty if anyone's interested.

I'll contribute 0.5 BTC for said bounty.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 11, 2013, 09:48:24 AM
We could also use a JavaScript library while everyone is at it. :)


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: serp on June 11, 2013, 03:06:22 PM
We could also use a JavaScript library while everyone is at it. :)

This is covered by https://github.com/bitcoinjs/bitcoinjs-lib


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: themgp on June 11, 2013, 04:24:22 PM
We could also use a JavaScript library while everyone is at it. :)

This is covered by https://github.com/bitcoinjs/bitcoinjs-lib

Perfect.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: akabmikua on June 11, 2013, 05:58:22 PM
We could also use a JavaScript library while everyone is at it. :)

This is covered by https://github.com/bitcoinjs/bitcoinjs-lib

Perfect.

Ok with JS? Why not try http://brainwallet.org/#verify

It works offline and is pretty good.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: serp on June 11, 2013, 08:03:16 PM
Ok with JS? Why not try http://brainwallet.org/#verify

It works offline and is pretty good.

If you look at the source you will see that the brainwallet you linked uses the bitcoinlib-js linked above.  Using the brainwallet software offline is fine if you are just doing one manually every now and then.  If you are wanting to incorporate the functionality into your own code then it is probably best to use the core library or just write your own.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: scintill on June 17, 2013, 06:17:30 AM
I'll contribute 0.5 BTC for said bounty.

OK, thanks.  I've got a first draft of some code that isn't working yet (the public-key recovery is a bit tricky), but should have most of what it needs.  So I need to fix the bug, do some test cases, and clean it up.  I'll try to have that done in the next day or so.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: scintill on July 10, 2013, 05:12:39 PM
I finished the PHP code and put it at https://github.com/scintill/php-bitcoin-signature-routines for those who are interested.

Let me know if you find any problems or have questions.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: scintill on November 30, 2013, 02:06:25 AM
I've been asked by someone in newbie jail, or unable to register, to post here this online signature verification tool he created: coinig.com (http://www.coinig.com/).  (Some CYA: this is not an endorsement of the correct functionality, security, privacy, etc. of the tool, just sharing a link.)


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: vitruvio on December 14, 2013, 02:41:46 PM
Congratulations for the good job.

Regards


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: jackjack on December 15, 2013, 02:12:08 PM
I've been asked by someone in newbie jail, or unable to register, to post here this online signature verification tool he created: coinig.com (http://www.coinig.com/).  (Some CYA: this is not an endorsement of the correct functionality, security, privacy, etc. of the tool, just sharing a link.)
Who's the guy?
Is he currently registered?


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: scintill on December 31, 2013, 12:48:20 AM
Who's the guy?
Is he currently registered?

I was respecting privacy, but on second thought I don't think he would mind.  His name is Gregor Volkmann and his site is at http://gregor.volkmann.me/ .  He contacted me by email so I don't have a username, and I couldn't find one with search.  I haven't heard from him since telling him I posted, so I guess he hasn't registered.  He probably only would have posted the link, but looking at his home page he seems open to being contacted, if people have questions or whatnot.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: the_beast on May 26, 2014, 09:18:49 AM
Maybe it's one more tool for handling signatures, but you could try FSV. This is a new multiple-platform GUI soft for PC. It's a pretty handy tool for signed messages checking.

https://bitcointalk.org/index.php?topic=623085.msg6904979#msg6904979


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: gweedo on May 27, 2014, 12:46:27 AM
If anyone wants apicoin can do many verifications of signatures at once, https://apicoin.io/api/v1/doc/#verifymessage


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: jonald_fyookball on May 27, 2014, 01:15:36 AM
is this done in PHP?

if not, i can do it, is there a bounty?


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: UserVVIP on October 16, 2015, 03:18:32 AM
It should be pretty easy to do either way.


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: rjmacarthy on October 16, 2015, 11:50:17 AM
I'd use bitcore.io to do this.

http://bitcore.io/api/transaction/transaction.html#Transaction#verifySignature

Javascript framework can be installed locally or using node.js.

Hope this helps.



Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: BitTalkyy on October 16, 2015, 02:47:33 PM
Check my tutorial with PHP here -> https://bitcointalk.org/index.php?topic=1210197.0


Title: Re: Verifying a signed message *without* a Bitcoin client installed?
Post by: bit22gen on October 16, 2015, 04:39:01 PM
If I have a Bitcoin address and a message signed with the private key of that address, is there a way to verify the signature with standard Unix commands?

bitsig (C++) can verify signatures:

http://bitcoin-gen.org/

Example:

$ bitsig verifyRaw "test" G93M44UVAiOAe7do7TJbtFrvedSpjoq6HFzCT0KZZW07/TvpE/qXxiZf6q7OV4nIqYkq9DDYPbvYTemsmpb0kbk= 17RjaCGZQbe2Cw984YdWcMcWDgM86kM7EN
Verifying raw message: test
Verifying signature...
Signed by the address: 17RjaCGZQbe2Cw984YdWcMcWDgM86kM7EN