Spending Coins with Taproot

Published by Mario Oettler on

Taproot provides three methods for spending Bitcoin:

  1. Raw public key
  2. Key Path Spend
  3. Script Path Spend

In a raw public key spend, you need to provide only the signature for the public key. It can be distinguished in a single signature and a multisignature spend.

In a Key Path Spend, the sender only needs to provide a signature that corresponds to the public key in the P2TR (Pay to Taproot) output.

In a Script Path Spend, the spender provides a script to prove that the P2TR output fits to the hash given in a MAST leaf. The spender also provides all other necessary information to successfully execute the script. Often, these data contain a signature.

A Key Path Spend and a Script Path Spend can be distinguished by the number of items in the witness stack. If there is only one item, it is a Key Path Spend. If there are more than one item in the witness stack, it is a Script Path Spend.

Example

The following transaction has two inputs. The first input is a Key Path Spend (only a single item in the witness stack). The second input is a Script Path Spend (more than one item in the witness stack).

You can find this transaction here: https://mempool.space/tx/37777defed8717c581b4c0509329550e344bdc14ac38f71fc050096887e535c8

Categories: