<p>According to <a href="https://bitcointalk.org/index.php?topic=70911.0" rel="nofollow noreferrer">this bitcointalk thread</a>, it can be done via the <a href="https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29" rel="nofollow noreferrer">JSON-RPC</a> API:
Code:</p>

<pre><code>verifymessage [address] [signature] [message]
</code></pre>

<p><a href="https://bitcoin.stackexchange.com/q/4137/516">See here for non-programmatical methods</a> to verify a message.</p>

CC BY-SA 3.0
2012-07-08T04:22:53.747Z
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
CC BY-SA 3.0
2012-07-08T04:26:23.413Z
@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
CC BY-SA 3.0
2012-07-08T04:14:20.273Z
2012-07-08T22:25:22.767Z
2017-04-13T12:47:36.647Z
Highly Irregular
<p>In the satoshi client the <code>verifymessage</code> command is implemented by <a href="https://github.com/bitcoin/bitcoin/blob/9af3c3c8249785a0106c14bce1cb72b3afc536e8/src/bitcoinrpc.cpp#L661" rel="nofollow">this code</a> which calls <a href="https://github.com/bitcoin/bitcoin/blob/9af3c3c8249785a0106c14bce1cb72b3afc536e8/src/key.cpp#L323" rel="nofollow"><code>CKey::SetCompactSignature()</code></a> to do its work.</p>

CC BY-SA 3.0
2012-07-08T04:38:38.483Z
I saw this, and thanks but I was looking more of pseudo code or documentation.
user1562
CC BY-SA 3.0
2012-07-08T04:34:11.393Z
2012-07-08T04:34:11.393Z
Chris Moore
<p>Even better than pseudocode: here's some python code for message signing and verification, largely pilfered from the electrum client:</p>

<p><a href="https://github.com/nanotube/supybot-bitcoin-marketmonitor/blob/master/GPG/local/bitcoinsig.py" rel="nofollow">https://github.com/nanotube/supybot-bitcoin-marketmonitor/blob/master/GPG/local/bitcoinsig.py</a></p>

CC BY-SA 3.0
2013-05-04T17:45:43.870Z
Is there any premade PHP class / code for this?
Max Min
CC BY-SA 3.0
2016-04-03T22:10:41.200Z
This seems to fail for signatures that came from -regtest. Has anyone updated it?
Aaron Ash
CC BY-SA 3.0
2012-07-08T05:05:05.597Z
2012-07-08T05:05:05.597Z
nanotube
<p>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.</p>

<address><message-signing><message-verification>
Pseudocode to verify a signed message
user1562
# Pseudocode to verify a signed message

(Asked by: username_0 on 2012-07-08)

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.

**Tags:** address, message-signing, message-verification


---

## 3 answers

### Answer by username_3 on 2012-07-08. Score: 4 | Accepted answer

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

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

> **Comments:**
> **username_4**: Is there any premade PHP class / code for this?  
> **username_5**: This seems to fail for signatures that came from -regtest. Has anyone updated it?  

---

### Answer by username_1 on 2012-07-08. Score: 2

According to [this bitcointalk thread](https://bitcointalk.org/index.php?topic=70911.0), it can be done via the [JSON-RPC](https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29) API:
Code:

```
verifymessage [address] [signature] [message]

```

[See here for non-programmatical methods](https://bitcoin.stackexchange.com/q/4137/516) to verify a message.

> **Comments:**
> **username_0**: 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.  
> **username_1**: @username_0, 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.  

---

### Answer by username_2 on 2012-07-08. Score: 1

In the satoshi client the `verifymessage` command is implemented by [this code](https://github.com/bitcoin/bitcoin/blob/9af3c3c8249785a0106c14bce1cb72b3afc536e8/src/bitcoinrpc.cpp#L661) which calls [`CKey::SetCompactSignature()`](https://github.com/bitcoin/bitcoin/blob/9af3c3c8249785a0106c14bce1cb72b3afc536e8/src/key.cpp#L323) to do its work.

> **Comments:**
> **username_0**: I saw this, and thanks but I was looking more of pseudo code or documentation.  

---

