0

When pre-Segwit nodes encounter blocks with Segwit transactions, they'll see them as "spent anyone can spend" transactions and so can validate them and move on to the next block.

However, when they encounter a transaction with the opcode 0x6a (Taproot only OP_CHECKSIGADD) they'd see it as an undefined opcode and thus see the transaction and its block as invalid. They would then fork or become stranded.

After reading this, though, it seems there is some way by which the old nodes handle/avoid OP_CHECKSIGADD.

What is the mechanism by which the old nodes handle the 0x6a/OP_CHECKSIGADD opcode or are able to see these transactions as a "spent anyone can spend"?

2 Answers 2

3

Tapscript can only appear in leaf scripts. Leaf scripts can only appear in the witness stack of a P2TR script path spend. Pre-segwit nodes don’t see witness data. Ergo, a pre-segwit node will never encounter an OP_CHECKSIGADD.

2
  • 1
    Oh, in my comment on the other answer I assumed OP was asking about pre-taproot nodes. But indeed, pre-segwit nodes won't see the script at all. Commented Apr 26 at 21:49
  • @PieterWuille And if one did try to include a tx with non-witness script with an 0x6a opcode in it; it would fail on pre-Segwit/pre-Taproot as undefined, and on post Taproot as it detects that it's not a P2TR.
    – Lee
    Commented Apr 27 at 7:16
2

OP_CHECKSIGADD is only defined for SegWit v1 (Taproot). A pre SegWit v1 node that doesn't recognize Taproot rules will treat all SegWit v1 outputs as "anyone can spend" regardless of whether it has a OP_CHECKSIGADD opcode in the script or not. (Of course it doesn't know about the OP_CHECKSIGADD rules). It is only doing partial verification on the transactions in a block and accepting any SegWit v1 spends as valid. Other nodes that do recognize SegWit v1 rules will do full verification of all transactions in the block and hence ultimately the pre SegWit v1 node will still follow the same chain.

In short the SegWit version is given precedence over the presence of an undefined opcode. An undefined SegWit version is "anyone can spend".

2
  • Thanks, my understanding is that the 0x6a opcode must only occur in the witness field of a transaction. If it was in the scriptSig or scriptPubKey field then all nodes would reject it.
    – Lee
    Commented Apr 26 at 12:08
  • 2
    @Lee When a pre-taproot node sees a taproot spend, they do not even get to seeing/interpreting any opcodes. They just see it as an output of an unknown type, and say "ok, no rules apply, all good". From their perspective, the spending of such an output does not involve any script at all. Commented Apr 26 at 14:07

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.