3

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]

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, and here is a description in bitcointalk forum.

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 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.

After having the "type 1" address, you may convert it to segwit address, and use again the same pubkey to go through this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.