The old legacy addresses starts with 1 and the new ones start with 3 and bc1. Can I use my old private key from 2012 to generate a bc1 address? And how so?
-
Why would you want that? You shouldn't reuse a key.– Pieter WuilleCommented Feb 10, 2018 at 22:59
-
I just want to verify if an old btc private key generates a segwit address of bc1 and 3. I just want to understand if its possible or not.– Patoshi パトシCommented Feb 14, 2018 at 16:07
-
There is no point in that. Use wallet software that supports segwit, and let it generate a new key. Why you'd voluntarily give up your privacy is beyond me.– Pieter WuilleCommented Mar 10, 2018 at 7:53
1 Answer
Addresses beginning with a 3 generated using addwitnessaddress
are called P2SH-P2WPKH addresses. That means it is a Pay-to-Witness-Public-Key-Hash (P2WPKH) script embedded in a Pay-to-Script-Hash (P2SH) address, which starts with a 3.
To restore from that private key, you should be able to just import the key into your wallet and call addwitnessaddress
on it again. Note that addwitnessaddress
is an experimental RPC call so the method to restoring may change in future, but you can always generate the corresponding public key hash (address) from the key, create a P2WPKH witness script for it, and wrap it in P2SH.