<blockquote>
  <p>How to quickly find the private key from Segwit P2SH address?</p>
</blockquote>

<p>As per today, it is impossible to find the private key from any public key or address. Also from a SegWit P2SH address. There is always hashing involved, which is a one way function. </p>

<p>I think you maybe wanted to ask, how to come to the public addresses (see below), so that you can extract corresponding priv key from bitcoin wallet...  </p>

<p>I think there is no quick way :-(</p>

<p>But with some programming and web page links, this might get you to your goal: </p>

<blockquote>
  <p>I have a very large list of Segwit addresses for bitcoin, starting
  with '3' and do not know the corresponding legacy '1' address for
  them.</p>
</blockquote>

<p>The way the type 3 addresses are composed includes once again a hash value, so you cannot easily "go back" - it is a one way function. The way how they are composed is <a href="https://bitcoin.stackexchange.com/questions/50631/redeem-script-for-segwit-addresses/71143#71143">described here</a>, and here is a description in <a href="https://bitcointalk.org/index.php?topic=1758855.0" rel="nofollow noreferrer">bitcointalk forum</a>. </p>

<blockquote>
  <p>How can I quickly find the corresponding legacy address to export the
  private key from Bitcoin Core?
  The Seqwit addresses have not received any transactions, yet.</p>
</blockquote>

<p>And here it gets difficult: unless there are some transactions spending with the redeem script of this segwit address (which usually reveals the redeem script in clear hex format), there is no way to get to the root data. But then again if you have the redeem script, it is a structure like this:</p>

<pre><code>OP_0:    00
Length:  14
keyhash: (20 bytes)
</code></pre>

<p>again with the hash of the corresponding "type 1" key. 
In <a href="https://bitcoin.stackexchange.com/questions/49596/how-to-get-addresses-from-scriptpubkey-in-segwit-transactions/49599#49599">this link</a> Pieter said you can't, and shouldn't.</p>

<p>So best for your work is to extract all priv keys from the wallet, and do "the reverse work". Take a priv key, and create the type 1 address from it (never expose your priv keys online, you will loose the funds! You need to do this offline!). A good page on how to do <a href="http://gobittest.appspot.com/Address" rel="nofollow noreferrer">is here</a>. </p>

<p>After having the "type 1" address, you may convert it to segwit address, and use again the same pubkey to <a href="https://bitcoin.stackexchange.com/questions/60961/generate-paper-wallet-segwit-address">go through this</a>.</p>

CC BY-SA 3.0
2018-02-20T11:55:31.507Z
2018-02-20T11:55:31.507Z
pebwindkraft
<p>I have a very large list of Segwit addresses for bitcoin, starting with '3' and do not know the corresponding legacy '1' address for them. </p>

<p>How can I quickly find the corresponding legacy address to export the private key from Bitcoin Core?</p>

<p>The Seqwit addresses have not received any transactions, yet.</p>

<p>I think I will need a script, or a program maybe...</p>

<p>[this is an issue with LTC having been sent to a segwit address generated using Bitcoin Core]</p>

<segregated-witness><p2sh><p2wpkh>
How to quickly find the private key from Segwit P2SH address?
Joe
# How to quickly find the private key from Segwit P2SH address?

(Asked by: username_0 on 2017-12-24)

I have a very large list of Segwit addresses for bitcoin, starting with '3' and do not know the corresponding legacy '1' address for them.

How can I quickly find the corresponding legacy address to export the private key from Bitcoin Core?

The Seqwit addresses have not received any transactions, yet.

I think I will need a script, or a program maybe...

[this is an issue with LTC having been sent to a segwit address generated using Bitcoin Core]

**Tags:** segregated-witness, p2sh, p2wpkh


---

## 1 answers

### Answer by username_1 on 2018-02-20. Score: 2

> How to quickly find the private key from Segwit P2SH address?

As per today, it is impossible to find the private key from any public key or address. Also from a SegWit P2SH address. There is always hashing involved, which is a one way function.

I think you maybe wanted to ask, how to come to the public addresses (see below), so that you can extract corresponding priv key from bitcoin wallet...

I think there is no quick way :-(

But with some programming and web page links, this might get you to your goal:

> I have a very large list of Segwit addresses for bitcoin, starting
> with '3' and do not know the corresponding legacy '1' address for
> them.

The way the type 3 addresses are composed includes once again a hash value, so you cannot easily "go back" - it is a one way function. The way how they are composed is [described here](https://bitcoin.stackexchange.com/questions/50631/redeem-script-for-segwit-addresses/71143#71143), and here is a description in [bitcointalk forum](https://bitcointalk.org/index.php?topic=1758855.0).

> How can I quickly find the corresponding legacy address to export the
> private key from Bitcoin Core?
> The Seqwit addresses have not received any transactions, yet.

And here it gets difficult: unless there are some transactions spending with the redeem script of this segwit address (which usually reveals the redeem script in clear hex format), there is no way to get to the root data. But then again if you have the redeem script, it is a structure like this:

```
OP_0:    00
Length:  14
keyhash: (20 bytes)

```

again with the hash of the corresponding "type 1" key.
In [this link](https://bitcoin.stackexchange.com/questions/49596/how-to-get-addresses-from-scriptpubkey-in-segwit-transactions/49599#49599) Pieter said you can't, and shouldn't.

So best for your work is to extract all priv keys from the wallet, and do "the reverse work". Take a priv key, and create the type 1 address from it (never expose your priv keys online, you will loose the funds! You need to do this offline!). A good page on how to do [is here](http://gobittest.appspot.com/Address).

After having the "type 1" address, you may convert it to segwit address, and use again the same pubkey to [go through this](https://bitcoin.stackexchange.com/questions/60961/generate-paper-wallet-segwit-address).


---

