<p>PSBT_IN_WITNESS_SCRIPT is specifically the actually executed script for a P2WSH or P2SH-P2WSH scriptPubKey being spent. It is added by an Updater who knows it.</p>
<p>PSBT_IN_FINAL_SCRIPTWITNESS is the witness stack needed to spend an output, including scripts, signatures, public keys, ... whatever is needed. It is created by a Finalizer, using other fields necessary (including PSBT_IN_WITNESS_SCRIPT) to produce it.</p>

CC BY-SA 4.0
2020-12-27T00:08:35.333Z
To clarify, SCRIPTWITNESS is the Segwit equivalent of ScriptSig, while WITNESS_SCRIPT is the Segwit equivalent of the redeemScript?

Or is WITNESS_SCRIPT the script for ScriptHash outputs, and it is separate by the redeemScript?
Sachin Meier
CC BY-SA 4.0
2020-12-27T00:18:33.683Z
The scriptWitness (PSBT_IN_FINAL_SCRIPTWITNESS) is the per-input witness stack, so indeed more or less equivalent to scriptSig (for _all_ segwit spends, not just P2WSH). The witness script (PSBT_IN_WITNESS_SCRIPT) is the executed script in P2WSH - similar to the redeemScript is P2SH.
Pieter Wuille
CC BY-SA 4.0
2020-12-26T23:42:20.593Z
2020-12-26T23:42:20.593Z
Pieter Wuille
<p>In <a href="https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki" rel="nofollow noreferrer">BIP 174/PSBT</a>, there is a PSBT Input key-value pair called &quot;PSBT_IN_WITNESS_SCRIPT&quot; (0x05) and another called &quot;PSBT_IN_FINAL_SCRIPTWITNESS&quot; (0x08). What is the difference between a WitnessScript and a scriptWitness?</p>
<p>From what I understood, a witness script is the witness data for a single input (the signatures and scripts that unlock it). Is the scriptWitness something different?</p>

<segregated-witness><script><bip174-psbt>
WitnessScript vs. Script Witness
Sachin Meier
# WitnessScript vs. Script Witness

(Asked by: username_0 on 2020-12-26)

In [BIP 174/PSBT](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki), there is a PSBT Input key-value pair called "PSBT\_IN\_WITNESS\_SCRIPT" (0x05) and another called "PSBT\_IN\_FINAL\_SCRIPTWITNESS" (0x08). What is the difference between a WitnessScript and a scriptWitness?

From what I understood, a witness script is the witness data for a single input (the signatures and scripts that unlock it). Is the scriptWitness something different?

**Tags:** segregated-witness, script, bip174-psbt


---

## 1 answers

### Answer by username_1 on 2020-12-26. Score: 2 | Accepted answer

PSBT\_IN\_WITNESS\_SCRIPT is specifically the actually executed script for a P2WSH or P2SH-P2WSH scriptPubKey being spent. It is added by an Updater who knows it.

PSBT\_IN\_FINAL\_SCRIPTWITNESS is the witness stack needed to spend an output, including scripts, signatures, public keys, ... whatever is needed. It is created by a Finalizer, using other fields necessary (including PSBT\_IN\_WITNESS\_SCRIPT) to produce it.

> **Comments:**
> **username_0**: To clarify, SCRIPTWITNESS is the Segwit equivalent of ScriptSig, while WITNESS_SCRIPT is the Segwit equivalent of the redeemScript?  Or is WITNESS_SCRIPT the script for ScriptHash outputs, and it is separate by the redeemScript?  
> **username_1**: The scriptWitness (PSBT_IN_FINAL_SCRIPTWITNESS) is the per-input witness stack, so indeed more or less equivalent to scriptSig (for _all_ segwit spends, not just P2WSH). The witness script (PSBT_IN_WITNESS_SCRIPT) is the executed script in P2WSH - similar to the redeemScript is P2SH.  

---

