In BIP 174/PSBT, 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?

1 Answer 1


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.

  • 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? Dec 27, 2020 at 0:08
  • 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. Dec 27, 2020 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.