2

When I ask the google what is the purpose of P2WPKH nested in P2SH, it says the following:

This allows the user to send funds to a SegWit (Segregated Witness) address using a non-SegWit transaction, which can be useful in cases where the user's wallet or software does not support SegWit transactions.

But I do not get it, if a wallet does not support segwit, how will a wallet then create a transaction with witness data to spends it.

So my question: What is the purpose of P2WPKH-P2SH? What do we get with sending SegWit type to non-segwit address (starting with 3 base58check for P2SH)?

1 Answer 1

7

P2SH-P2WPKH addresses can only be created by segwit-compatible wallet software. However, sending to a P2SH-P2WPKH works with any P2SH-compatible wallet, as the address is indistinguishable from (and effectively is) a P2SH address.

It was useful in a time before most wallets supported segwit, as even those that did not usually supported P2SH.

17
  • So there is no need (real purpose) anymore for P2SH-P2WPKH? Btw is it correct to say P2SH-P2WPKH or P2WPKH-P2SH for P2WPKH nested in P2SH?
    – dassd
    Commented Sep 3, 2023 at 19:27
  • You can say what you want, but I think P2SH-P2WPKH is a lot more common. Most (but still not all) wallets support BIP173 (native segwit v0 addresses) now, so it is certainly less useful than a few years ago. Commented Sep 3, 2023 at 19:32
  • 4
    I think you're confusing sender and receiver. The receiver creates the address, and they only create addresses they know how to spend from. So P2SH-P2WPKH can be used by receivers who support segwit, but with senders that only support P2SH (but do not know about segwit, as they don't care). When the funds arrive at the receiver, and they want to send those funds onward, they need a segwit spend, but they know how to construct that, as they are a segwit wallet. Commented Sep 3, 2023 at 19:55
  • 1
    @maximus Exactly. You get the benefits of segwit (with a small penalty, the P2SH wrapping has a cost), but you get to receive coins from senders who do not support native segwit addresses. Commented Sep 3, 2023 at 21:17
  • 3
    @maximus bitcoin.stackexchange.com/a/84006/140802
    – dassd
    Commented Sep 4, 2023 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.