Taproot witness information format – Bitcoin Stack Trade

0
95
Taproot witness information format – Bitcoin Stack Trade


From BIP341:

A Taproot output is a local SegWit output (see BIP141) with model
#1, and a 32-byte witness program. […]

  • Let q be the 32-byte array containing the witness program (the second push within the scriptPubKey) which represents a public key
    in keeping with BIP340.
  • Fail if the witness stack has 0 parts.
  • If there are not less than two witness parts, and the primary byte of the final aspect is 0x50, this final aspect is named annex a
    and is faraway from the witness stack. The annex (or the shortage of
    thereof) is all the time coated by the signature and contributes to
    transaction weight, however is in any other case ignored throughout taproot
    validation.
  • If there’s precisely one aspect left within the witness stack, key path spending is used:
    • The only witness stack aspect is interpreted because the signature and have to be legitimate (see the following part) for the general public key
      q (see the following subsection).
  • If there are not less than two witness parts left, script path spending is used:
    • Name the second-to-last stack aspect s, the script.

In different phrases, Taproot key path spends solely have one1 witness merchandise, the signature. Script path spends all the time have not less than two witness objects, and often extra to offer an preliminary stack for the script execution.

Since BIP340 signatures do not enable public key restoration, you’ll be able to’t compute the general public key (and subsequently deal with) from the signature alone in a key path spend. In a script path spend, you might mix the revealed inner key with the foundation of the script to get the general public key.

Nonetheless, getting the output script of the output being spent is so simple as trying up the transaction output referenced by the txid and index within the enter, so there’s hardly ever a motive to make use of a technique that solely works for some output scripts, and requires you to know the output kind (P2TR on this case) within the first place.


1 Assuming the annex is just not current.

LEAVE A REPLY

Please enter your comment!
Please enter your name here