<p>That depends on what type of P2SH address it is. Only some P2SH script types actually have a one-to-one relationship with a private key. The most common case is probably embedded segwit. If its a P2SH-P2WPKH address, you can retrieve the public key from the embedded P2WPKH script using the <code>dumpprivkey</code> RPC command.</p>

CC BY-SA 3.0
2018-04-23T00:52:29.973Z
lol I never would have guessed that. To me, `dump` and `get` are very different. Thank you!
toddmo
CC BY-SA 3.0
2018-04-23T00:58:59.243Z
Shucks. `signmessagewithprivkey` worked with P2SH address, but `verifymessage` still throws an error with the address used in `signmessagewithprivkey` and the resulting signature. Should I ask another question or is `verifymessage` just going to be impossible with `P2SH`?
toddmo
CC BY-SA 3.0
2018-04-23T04:34:23.420Z
`verifymessage` tries to use the private key corresponding to the address it is given, but again, P2SH addresses don't always have private keys so it won't work. Unfortunately there is no equivalent of "verifymessagewithprivkey" to my knowledge
meshcollider
CC BY-SA 3.0
2018-04-23T17:51:15.630Z
lol exactly. if I had the private key, I would not have to verify that the owner of the public key can spend the funds. So I don't guess `verifymessagewithprivkey` would do me any good. Back to the drawing board it is!
toddmo
CC BY-SA 3.0
2018-04-24T02:10:15.293Z
Sorry I meant "verifymessagewithpubkey" lol, the public key would be required for verification
meshcollider
CC BY-SA 3.0
2018-04-23T00:11:38.810Z
2018-04-23T00:11:38.810Z
meshcollider
<p><strong>Background</strong></p>

<p>I saw this on the internet</p>

<p><a href="https://i.sstatic.net/Lir4l.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Lir4l.png" alt="enter image description here"></a></p>

<p>I didn't think signing / verifying was possible with P2SH addresses, so I guess this wallet must be using something like <code>signmessagewithprivkey</code><br>
     ¯\_(ツ)_/¯</p>

<p>Anyway, with <code>signmessagewithprivkey "privkey" "message"</code>, <code>privkey</code> is required and doesn't provide a default.</p>

<p><strong>Actual Question</strong></p>

<p>How do I get (see) my private key?</p>

CC BY-SA 3.0
2018-04-23T00:39:08.427Z
Additionally, this looks like the Trezor interface. From what I recall, they have a non-standard segwit address message signature, which isn't supported or verifiable by other clients. There is some discussion on standardising to Trezor's implementation here: https://github.com/spesmilo/electrum/issues/3861
Raghav Sood
CC BY-SA 3.0
2018-04-23T01:01:25.813Z
@RaghavSood, being able to verify the owner of some funds is very important. When we went to segwit that fell through. I understand, technical reasons, but the business need remains.
toddmo
<json-rpc><message-signing><private-key-export>
How do I get my private key?
toddmo
# How do I get my private key?

(Asked by: username_0 on 2018-04-22)

**Background**

I saw this on the internet

[![enter image description here](https://i.sstatic.net/Lir4l.png)](https://i.sstatic.net/Lir4l.png)

I didn't think signing / verifying was possible with P2SH addresses, so I guess this wallet must be using something like `signmessagewithprivkey`  
¯\\_(ツ)\_/¯

Anyway, with `signmessagewithprivkey "privkey" "message"`, `privkey` is required and doesn't provide a default.

**Actual Question**

How do I get (see) my private key?

**Tags:** json-rpc, message-signing, private-key-export

> **Comments:**
> **username_1**: Additionally, this looks like the Trezor interface. From what I recall, they have a non-standard segwit address message signature, which isn't supported or verifiable by other clients. There is some discussion on standardising to Trezor's implementation here: https://github.com/spesmilo/electrum/issues/3861  
> **username_0**: @username_1, being able to verify the owner of some funds is very important. When we went to segwit that fell through. I understand, technical reasons, but the business need remains.  

---

## 1 answers

### Answer by username_2 on 2018-04-23. Score: 2 | Accepted answer

That depends on what type of P2SH address it is. Only some P2SH script types actually have a one-to-one relationship with a private key. The most common case is probably embedded segwit. If its a P2SH-P2WPKH address, you can retrieve the public key from the embedded P2WPKH script using the `dumpprivkey` RPC command.

> **Comments:**
> **username_0**: lol I never would have guessed that. To me, `dump` and `get` are very different. Thank you!  
> **username_0**: Shucks. `signmessagewithprivkey` worked with P2SH address, but `verifymessage` still throws an error with the address used in `signmessagewithprivkey` and the resulting signature. Should I ask another question or is `verifymessage` just going to be impossible with `P2SH`?  
> **username_2**: `verifymessage` tries to use the private key corresponding to the address it is given, but again, P2SH addresses don't always have private keys so it won't work. Unfortunately there is no equivalent of "verifymessagewithprivkey" to my knowledge  
> **username_0**: lol exactly. if I had the private key, I would not have to verify that the owner of the public key can spend the funds. So I don't guess `verifymessagewithprivkey` would do me any good. Back to the drawing board it is!  
> **username_2**: Sorry I meant "verifymessagewithpubkey" lol, the public key would be required for verification  

---

