0

This Taproot transaction has 3 witness items which are initial stack for P2TR script. Execution of the tapscript goes something like this:

  1. push (4 items on the stack)
  2. checksig operation (results in pushing 1 on the stack - we are back on a 3 items on the stack)
  3. push an empty element (4 items on the stack)
  4. OP_IF with an empty element as an input; it does not evaluate (3 items on the stack)
  5. the end (3 items on the stack)

Since the consensus rule for tapscript is that execution can't result in anything but exactly one element on the stack which evaluates to true, I am asking how is this transaction valid?

1 Answer 1

2

There are indeed 3 witness items, but only the first of them forms the initial stack. The second is the script itself (shown in disassembled form further on the page you linked to), and the third is the taproot control block (which proves how spending with this script is permitted by the output).

There are two kinds of P2TR spends:

  • Key path spends, which have exactly one witness stack element.
  • Script path spends, which have two or more witness stack elements (the last one is the control block, the penultimate one the script, and all the ones before form the initial execution stack).

Both of these can optionally have an annex as last element, which is ignored for the purposes of determining key path vs. script path spends. The annex is characterized by starting with byte 0x50.

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.