How do I generate a SegWit address using Bitcoin Core CLI? Also will I be able to redeem those outputs and send them to a "legacy" address? If so, will this second transaction be accepted by older, non-SegWit clients?
It's intended not to be easy for users to create P2WPKH addresses until it's live on the network.– m1xolyd1anAug 9, 2017 at 14:34
It doesn't seem to be complicated as per the response below.– PaulAug 9, 2017 at 18:48
How do I generate a SegWit address using Bitcoin Core CLI?
You can use
addwitnessaddress addr, where addr is an existing P2PKH or P2SH address of yours. It will construct a P2SH-P2WPKH or P2SH-P2WSH address with the same key/script, if known to be valid.
Note that this command is not available until SegWit is active on the network, as before that time, such outputs would be spendable by everyone.
Since Bitcoin Core v0.16.0, P2SH-P2WPKH addresses are the default, and the
addwitnessaddress RPC is deprecated.
Also will I be able to redeem those outputs and send them to a "legacy" address?
If so, will this second transaction be accepted by older, non-SegWit clients?
Yes, it is a softfork. Every new transaction is valid according to the old rule. If not, a chain split would occur. Older clients may not see the transaction until it is confirmed, however.
2That means I need to generate a "legacy" address and then pass it to addwitnessaddress and it will return a "segwit" address? And I will be able to send the bitcoins received in that "segwit" address to any other address and older clients will not complain (they will "receive" those bitcoins)?– PaulAug 9, 2017 at 18:46
2Yes to all of those. Aug 9, 2017 at 18:55
2in case anyone is interested: the legacy address used to create the SegWit address and the resulting witness address share the same private key.– venzenOct 25, 2017 at 7:06
1Is there perhaps any benefit in using a P2SH address instead of a P2PKH address?– venzenOct 25, 2017 at 7:11
Why do you need to do this stupid addwitness to a different address? It does not make any sense. Dec 11, 2017 at 15:59