Skip to main content
3 of 4
edited title
dassd
  • 1.1k
  • 1
  • 4
  • 22

What does CTxOut represent in BIP143 and BIP341?

The term CTxOut is mentioned several times in BIP143 and BIP341. However, I can't understand what it actually represents? I assume it's just the transaction output, but I am not sure and the confusion comes from the following. BIP143 says:

  • For P2WSH witness program,
    • if the witnessScript does not contain any OP_CODESEPARATOR, the scriptCode is the > witnessScript serialized as scripts inside CTxOut.

I know that the witness script in P2WSH is the same as the redeem script in P2SH. While in P2SH the redeem script is the last push inside scriptSig, the witness script in P2WSH is the last item on the witness stack, that is the last item in witness data. However, in both cases, this (redeem/witness) script in the output is serialized in the form of its hash. Since I know that the scriptCode in P2WSH is the witness script (with its operators and data) and not its hash, CTxOut looks more like the witness data section of the transaction to me than the output of the transaction.

What is the CTxOut? Am I misinterpreting what is written in BIP143?

dassd
  • 1.1k
  • 1
  • 4
  • 22