in

What is the script assembly and execution in P2TR (pay to Taproot)

So I [have found](https://learnmeabitcoin.com/technical/p2pkh) and fundamentally understand how P2PKH is assembled from inputs and outputs to create a bitcoin [forth-like script](https://en.bitcoin.it/wiki/Script) for execution.

I looked at the SegWit BIP [examples section](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#examples) and I found them easy enough to understand as well.

But looking at the [Taproot BIP](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#constructing-and-spending-taproot-outputs), I’ve likely reached my limit. It’s very well written, but I just can’t get a handle on it.

Can anyone look at my recent testnet [P2TR spend](https://blockchair.com/bitcoin/testnet/transaction/821c5e4dd98c217efc7e2653b24cfba84369d696cf22ec873ae1f93dff075de1) ([raw-ish JSON](https://api.blockchair.com/bitcoin/testnet/dashboards/transaction/821c5e4dd98c217efc7e2653b24cfba84369d696cf22ec873ae1f93dff075de1)) and show me how the `witnessData`, `scriptPubKey`, and `sigScript` data is used to construct a bitcoin forth-like script for execution and validation? I’m only interested in single-sig Taproot. After I grasp that perhaps I can expand to multisig-taproot. I know the python samples are provided in the BIP, but honestly, still just don’t get it.

BTW.. I can provide the testnet privkey if needed, though I might need to rebuild the TXN.

I’ve also [XPosted on SE](https://bitcoin.stackexchange.com/q/111098/5750) if you need to make some SE-karma



View Reddit by brianddkView Source

Leave a Reply

Your email address will not be published.

GIPHY App Key not set. Please check settings

2 Comments

  1. When you spend a p2tr output, you either just provide a signature (a “key path” spend) or else your witness will include the script and all the inputs to the script. The script here is pretty much the same as a p2sh script.

    The only scripts you can provide are the ones that were encoded in the p2tr output’s merkle tree originally, and you need to provide both the merkle path to that script and the internal pubkey that was combined with the merkle root to generate the original p2tr output.

What do you think?

Square to Consider Building a Bitcoin Mining System

Bitcoin Technical Indicator Suggests Low Probability of ‘Santa Rally’

ADA Price Chart

Cardano (ADA) Shows Recovery but Struggles Around $1.5