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?
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.
-
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 '17 at 9:34
-
-
can i generate the legacy address back from the segwit address? example : getlegacyaddress <segwit-addr> – Karan Ahuja Dec 27 '17 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. – Pieter Wuille Dec 27 '17 at 8:45