Use old legacy bitcoin private key generated from 2012 to generate a segwit address

0

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?

Patoshi パトシ

Posted 2018-02-10T20:37:07.480

Reputation: 8 911

Why would you want that? You shouldn't reuse a key.Pieter Wuille 2018-02-10T22:59:05.607

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 パトシ 2018-02-14T16:07:41.257

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 Wuille 2018-03-10T07:53:54.970

Answers

1

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.

skang404

Posted 2018-02-10T20:37:07.480

Reputation: 548