I think I know the answer, but want to make sure asking here. I have my old privkey/WIF and some funds on associated legacy bitcoin address. Reading this code https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L50 I think I can make a segwit address out of my private key, transfer all funds to this segwit address, and I will still be able to use old private key to control those funds? Thanks!
1 Answer
Yes. If the P2SH-P2WPKH is implied (which is segwit reflection of plain old P2PKH like in your case), you still use one private key to derive a segwit address, and you still can reuse this private key to create a redeem script.
In fact, segwit address is derived from a redeem script.
But, there is a restriction, that unlike P2PKH, where you can use uncompressed and compressed public keys to create two separate addresses, in P2SH-P2WPKH, only compressed one must be used.
So, it is technically possible, given that you fully control address and transaction generation. Otherwise, it is on your wallet to give you such functionality.