1

I have a Segwit P2SH address (starting with 3...) with the corresponding private key and need to obtain the legacy address (starting with 1...) and the private key. Is this possible?

1 Answer 1

2

You have the private key so you can just derive the address from there. Get the corresponding public key, hash it with SHA256 and then that result with RIPEMD160. Then perform Base58Check Encoding on it.

4
  • Thanks, will try. And the result of this is the 1.. legacy address? How do I get the private key for it? Commented Nov 27, 2017 at 9:34
  • The private key is the same private key for your segwit address. Commented Nov 27, 2017 at 15:34
  • can i generate the legacy address back from the segwit address? example : getlegacyaddress <segwit-addr> Commented Dec 27, 2017 at 8:41
  • 1
    @KaranAhuja If you need a legacy address, you should create a new legacy address rather than converting an existing one. The 'addwitnessaddress' approach was intended for testing only; over time, Bitcoin Core won't allow you to convert one address type into another anymore. Commented Dec 27, 2017 at 8:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.