Script Witness
1 min read
The Script Witness contains the signatures and public keys, which together unlock bitcoin sent in a SegWit transaction. The Script Witness is similar to the ScriptSig of a legacy transaction, except the Script Witness resides at a different location than the ScriptSig within a transaction. Each SegWit input has its own Script Witness, and all Script Witnesses comprise the Witness field.
The Segregated Witness (SegWit) upgrade introduced the Witness field, which holds the Script Witnesses in order to solve the issue of malleability. This prevents a change to a signature from affecting the txid after signing, an issue which affected legacy transactions.
The Script Witness should not be confused with the Witness Script. 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.