Glossary

Witness Script

1 min read

The Witness Script is the script which outlines the requirements to spend a Pay-to-Witness-Pubkey-Hash (P2WSH) output. Most commonly, Witness Scripts define the setup of a SegWit multisig wallet.

Learn more about SegWit.

A P2WSH output is a SegWit scriptPubKey which contains the hash of the Witness Script. In order to spend a P2WSH output, the owner must produce the Witness Script whose hash matches the hash provided in the scriptPubKey as well as the signatures and public keys required by the Witness Script.

The Witness Script is the SegWit equivalent of the redeemScript in a P2SH transaction. However, while the redeemScript of a P2SH transaction is included in the ScriptSig, the Witness Script is included in the Witness field, making P2WSH inputs cheaper to spend than P2SH inputs.

The Witness Script should not be confused with the Script Witness. The Script Witness contains the Witness data of any SegWit input. In fact, the Script Witness is not a form of Script; it is simply data used by the script.

On the other hand, the Witness Script is the script which defines the spending conditions of a P2WSH input, and the Witness Script is a form of Script.