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.
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
-
2
-
This seems to fail for signatures that came from -regtest. Has anyone updated it? – Aaron Ash Apr 3 '16 at 22:10
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.
-
1Thanks 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 8 '12 at 4: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 8 '12 at 4:26
In the satoshi client the verifymessage
command is implemented by this code which calls CKey::SetCompactSignature()
to do its work.
-
1I saw this, and thanks but I was looking more of pseudo code or documentation. – user1562 Jul 8 '12 at 4:38