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 P2WSHscriptPubKey. - 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
Related chapters
Sources (6)
- BIP 141 - Segregated Witness, nested witness programs: in the 'P2WSH nested in BIP16 P2SH' example the scriptSig holds the redeem script 0 <32-byte-hash> (35 bytes) and the scriptPubKey is HASH160 <20-byte-hash> EQUAL, 11 bytes smaller than native P2WSH; the nested P2WPKH example adds that a nested witness program's address is 'fully transparent and backward compatible for all Bitcoin reference client since version 0.6.0'; a non-upgraded wallet can send to an upgraded one using a P2SH address
- mempool.space - block 481,824 (01:57 UTC, August 24, 2017), the first block under SegWit rules
- Bitcoin Core 0.16.0 release notes (February 26, 2018): full segwit support in the wallet, a new -addresstype option with legacy, p2sh-segwit (default) and bech32, controlling getnewaddress and createmultisigaddress; full support for native segwit (bech32) addresses added
- Bitcoin Core - BIPs implemented (doc/bips.md): BIP 16 took effect on April 1, 2012; bech32 addresses supported as of v0.16.0 and generated by default as of v0.20.0
- BIP 48 - Multi-Script Hierarchy for Multi-Sig Wallets: script_type 1' is nested SegWit (p2sh-p2wsh) and 2' is native SegWit (p2wsh); the recommended default for wallets is p2wsh
- mainnet-observer - Input Types by Count (daily CSV read October 14, 2026): nested P2WSH spends outnumbered native P2WSH spends every year from 2017 through 2022 (2020: 30.0M against 3.1M, 10.3% of all inputs), native pulled ahead in 2023, and nested P2WSH was 0.6% of inputs in 2026
External references (3)
Related terms (6)
Published . Revised . No corrections logged for this page.
Edit this page on GitHub