7

Can someone explain or point to some documents with pseudo code that would show me how to verify bitcoin address based on a signature and message. I know how to do this in clients I want to know how to programmatically do it.

Highly Irregular
  • 10,960
  • 6
  • 54
  • 103
user1562
  • 73
  • 5

3 Answers3

4

Even better than pseudocode: here's some python code for message signing and verification, largely pilfered from the electrum client:

https://github.com/nanotube/supybot-bitcoin-marketmonitor/blob/master/GPG/local/bitcoinsig.py

nanotube
  • 2,260
  • 14
  • 13
2

According to this bitcointalk thread, it can be done via the JSON-RPC API: Code:

verifymessage [address] [signature] [message]

See here for non-programmatical methods to verify a message.

Highly Irregular
  • 10,960
  • 6
  • 54
  • 103
  • 1
    Thanks for the answer, but I am looking for technical or pseudo code explanation of the verify of a signed message. I want to use it in a program. – user1562 Jul 08 '12 at 04:22
  • @user1562, I wonder if you might be best to start wih the source code for the bitcoin.org client? If you search the source for "verifymessage" you might be able to find some code you can reuse. – Highly Irregular Jul 08 '12 at 04:26
1

In the satoshi client the verifymessage command is implemented by this code which calls CKey::SetCompactSignature() to do its work.

Chris Moore
  • 14,825
  • 6
  • 66
  • 87