<p>Use <code>signmessagewithprivkey</code> for non legacy addresses.</p>

CC BY-SA 4.0
2021-05-26T11:52:33.833Z
2021-05-26T11:52:33.833Z
liorko
<p><code>signmessage</code> and <code>verifymessage</code> only work with legacy type addresses. They do not work with segwit addresses. There is ongoing work to introduce a new message signing standard that will work regardless of address type.</p>
<p>Some discussion about why they only work on legacy addresses can be found in this issue: <a href="https://github.com/bitcoin/bitcoin/issues/10542" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/issues/10542</a></p>

CC BY-SA 4.0
2020-08-12T17:52:29.403Z
Is there a way for me to request legacy addresses from my wallet?
Sachin Meier
CC BY-SA 4.0
2020-08-12T17:53:37.500Z
`getnewaddress "" legacy`
Ava Chow
CC BY-SA 4.0
2020-08-12T17:47:55.280Z
2020-08-12T17:47:55.280Z
Ava Chow
<p>I am trying the following commands on my v0.19.0.1 Core implementation:
<code>CLI signmessage $(CLI getnewaddress) &lt;message&gt;</code>
and the identical
<code>CLI signmessagewithprivkey $(bitcoin-cli dumpprivkey $(CLI getnewaddress)) &lt;message&gt;</code></p>
<p>Both times I get Error code: -3 &quot;Address does not refer to key&quot;
All my addresses are wrapped-Segwit (3...). Does this mean since its P2SH there is no way to find the privkey from the address?</p>
<p>Thank you</p>

<address><bitcoin-cli><message-signing><cli>
signmessage and verifymessage CLI commands not accepting Address from getnewaddress?
Sachin Meier
# signmessage and verifymessage CLI commands not accepting Address from getnewaddress?

(Asked by: username_0 on 2020-08-12)

I am trying the following commands on my v0.19.0.1 Core implementation:
`CLI signmessage $(CLI getnewaddress) <message>`
and the identical
`CLI signmessagewithprivkey $(bitcoin-cli dumpprivkey $(CLI getnewaddress)) <message>`

Both times I get Error code: -3 "Address does not refer to key"
All my addresses are wrapped-Segwit (3...). Does this mean since its P2SH there is no way to find the privkey from the address?

Thank you

**Tags:** address, bitcoin-cli, message-signing, cli


---

## 2 answers

### Answer by username_2 on 2020-08-12. Score: 3 | Accepted answer

`signmessage` and `verifymessage` only work with legacy type addresses. They do not work with segwit addresses. There is ongoing work to introduce a new message signing standard that will work regardless of address type.

Some discussion about why they only work on legacy addresses can be found in this issue: <https://github.com/bitcoin/bitcoin/issues/10542>

> **Comments:**
> **username_0**: Is there a way for me to request legacy addresses from my wallet?  
> **username_2**: `getnewaddress "" legacy`  

---

### Answer by username_1 on 2021-05-26. Score: 1

Use `signmessagewithprivkey` for non legacy addresses.


---

