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.

3 Answers 3


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


  • 2
    Is there any premade PHP class / code for this?
    – Max Min
    Commented May 4, 2013 at 17:45
  • This seems to fail for signatures that came from -regtest. Has anyone updated it?
    – Aaron Ash
    Commented Apr 3, 2016 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.

  • 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
    Commented Jul 8, 2012 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. Commented Jul 8, 2012 at 4:26

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

  • 1
    I saw this, and thanks but I was looking more of pseudo code or documentation.
    – user1562
    Commented Jul 8, 2012 at 4:38

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.