Post
Topic
Board Development & Technical Discussion
Re: SegWit change addresses?
by
ScripterRon
on 29/11/2016, 15:48:38 UTC
For my own wallet, I've taken the approach of providing both P2PKH ('1') and P2SH-P2WPKH ('3') addresses for each private key.  The user can select either address when providing a receive address to an external site. 

When sending coins, the transaction type is determined by the outputs being spent.  A witness transaction will be created if any output is a witness output.  Otherwise, a legacy transaction is created.  The change address is then selected based on the transaction type.

This should provide interoperability with both new and old wallets.  Even if segwit is activated, that doesn't mean a particular web site will accept witness transactions.  So wallets will need to support both for some time.