Pay-to-Witness-Script-Hash (P2WSH)
Pay-to-Witness-Script-Hash (P2WSH) is a Bitcoin transaction type that combines the flexibility of Pay-to-Script-Hash (P2SH) with the benefits of Segregated Witness (SegWit). With P2WSH, bitcoins are secured using the hash of a script, often called the RedeemScript. To unlock these funds, the spender must provide both the original script and all necessary digital signatures.
A P2WSH address represents a SegWit version of script-based locking, where the locking instructions (ScriptPubKey) reference the hash of the WitnessScript. When spending from a P2WSH output, the unlocking data—previously held in the ScriptSig for legacy transactions—moves to the transaction’s Witness field, improving security and efficiency. P2WSH enables complex conditions for spending bitcoin while benefiting from lower transaction fees and enhanced protection against certain types of transaction malleability.