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?
    – JohnDoe
    Nov 27, 2017 at 9:34
  • The private key is the same private key for your segwit address.
    – Andrew Chow
    Nov 27, 2017 at 15:34
  • can i generate the legacy address back from the segwit address? example : getlegacyaddress <segwit-addr> 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. Dec 27, 2017 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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