Skip to content
LearnBitcoin

LearnGlossary

P2SH-P2WSH (Nested SegWit Script)

A P2WSH output wrapped in a P2SH outer layer so the address looks legacy (starts with '3') while the spend uses SegWit witness data.

P2SH-P2WSH - sometimes called "nested SegWit script" or "P2SH-wrapped P2WSH" - is a P2WSH output wrapped inside a P2SH outer layer. The address looks legacy (starts with 3), but the spend follows SegWit rules: the redeem script just commits to a P2WSH scriptPubKey, and the actual witness data sits outside the legacy transaction structure.

It existed for one reason: backwards compatibility during the SegWit rollout that began in 2017.

When SegWit activated in August 2017, most wallets and exchanges could not yet send to native SegWit addresses (bc1q...); Bitcoin Core's own wallet only added them in version 0.16.0 (February 2018), and even then made wrapped SegWit its default. Everyone did know how to send to 3... addresses (P2SH had been around since 2012, via BIP-16). To let users adopt SegWit before the rest of the ecosystem caught up, wallets generated P2SH-P2WSH addresses: legacy-looking on the outside, SegWit on the inside. Senders saw a familiar 3... address; the receiver got SegWit's fee discount and malleability fix.

How the wrapping works:

  • Receive. The address is the hash of a short redeem script: OP_0 <32-byte-script-hash>, which is itself a P2WSH scriptPubKey.
  • Spend. The input reveals that redeem script (P2SH semantics), and the actual spending script plus signatures live in the witness stack (SegWit semantics).

In practice it is a P2WSH spend with one extra wrapping layer. The wrapper costs 35 bytes of scriptSig on every spend (the output itself is 11 bytes smaller than native P2WSH), and you get the SegWit benefits inside.

Where you would see it:

  • Wallets set up between 2017 and 2020 that wanted SegWit benefits without breaking sender compatibility. Bitcoin Core's wallet defaulted to wrapped SegWit from version 0.16.0 until version 0.20.0 (June 2020) switched it to bc1q.
  • Multisig setups from that era. BIP 48, which standardized multisig derivation paths, gives nested and native SegWit their own script types, and nested P2WSH spends outnumbered native P2WSH spends on the chain every year from 2017 through 2022.

Modern picture:

  • New wallets default to native SegWit (bc1q...) or Taproot (bc1p...), and BIP 48's recommended default for multisig is native P2WSH. No reason to nest anymore.
  • Existing P2SH-P2WSH UTXOs are still spendable forever; nothing about the format expired. They were still about half a percent of all inputs in 2026.
  • If you hold one, sweeping it to a native SegWit or Taproot address on a fee-light day costs you a transaction but pays back in lower future spend costs.

The same pattern exists for single-sig: P2SH-wrapped P2WPKH gives a 3... address that spends under SegWit. Same rationale, same modern story.

Key takeaways

  • Backwards-compatibility hack from the SegWit rollout that began in 2017
  • Receive address looks like P2SH (starts with '3'), but the spend uses witness data
  • Larger and more expensive than native P2WSH; modern wallets default to bc1q or Taproot

Sources (6)

External references (3)

Related terms (6)

Published . Revised . No corrections logged for this page.

Edit this page on GitHub