Skip to main content
Share Your Experience: Take the 2024 Developer Survey
30 votes
Accepted

What is the script assembly and execution in P2TR spend (spend from Taproot)

Before we start I realize your question is only about single-sig scenarios, and you want an answer focused on how validation works. I will address these things, but I think I need to elaborate a bit ...
Pieter Wuille's user avatar
15 votes
Accepted

How can I find samples for P2TR transactions on mainnet?

Taproot activated in block 709 632, but the first P2TR transactions were in block 709 635. A few P2TR transactions that may be useful for test vectors would be: 33e7…9036, the first P2TR transaction ...
Murch's user avatar
  • 75.7k
13 votes
Accepted

XPRIV/XPUB type for P2TR

There is no ypub/zpub similar thing for Taproot. The recommendation is to use xpriv/xpub along with some extra information indicating that the script to create is Taproot, (e.g. with a tr() descriptor)...
Ava Chow's user avatar
  • 70.8k
13 votes
Accepted

BIP-341: Should key-path-only P2TR be eschewed altogether?

Let's first introduce some terminology, because "key path only" could mean different things. Say: A raw taproot output is one where the output key (the one in the scriptPubKey) is exactly ...
Pieter Wuille's user avatar
11 votes
Accepted

Is there an economic incentive to switch from P2WPKH to P2TR?

Facts A P2WPKH input weighs 68 vB (assuming the worst-case with a high-r signature, -0.25 vB with a low-r signature) and a P2WPKH output weighs 31 vB for a total of 99 vB. A P2TR input weighs 57.5 vB ...
Murch's user avatar
  • 75.7k
10 votes

What is the largest multisig quorum currently possible?

The rules governing this depend on the type of script used and whether that script is in the output script, in a P2SH, in a P2WSH, or in P2TR. Additionally, the rules are more restrictive for ...
Ava Chow's user avatar
  • 70.8k
9 votes
Accepted

How can I create P2TR addresses with Bitcoin Core 22.0?

This functionality in the Bitcoin Core wallet has deliberately not been merged pre activation to prevent users from easily generating and giving out Taproot addresses prior to the Taproot rules being ...
Michael Folkson's user avatar
9 votes
Accepted

Should the Bitcoin Core wallet (or any wallet) prevent users from sending funds to a Taproot address pre activation?

TL;DR: Wallets SHOULD allow sending to all bech32m addresses at this point, but wallets MUST NOT request P2TR outputs before the Taproot spending rules are enforced on the network¹. The design of ...
Murch's user avatar
  • 75.7k
8 votes

XPRIV/XPUB type for P2TR

The concept of an xpub originates from BIP32, where it denotes an extended public key, from which multiple child keys can be derived. At the time of BIP32, there was really only one address type ...
Pieter Wuille's user avatar
8 votes
Accepted

How do the fees for taproot transactions compare to P2WPKH?

Taproot inputs are smaller but outputs are larger. Specifically, P2WPKH (Native SegWit) inputs and outputs take 68 and 31 vbytes in a transaction, respectively, while P2TR (Taproot) inputs and outputs ...
Vojtěch Strnad's user avatar
8 votes

Is a P2TR address a compressed public key?

SEC encoded public keys are either: Uncompressed 65-byte encoding: 0x04 + [32-byte X coordinate] + [32-byte Y coordinate] Compressed 33-byte encoding: 0x02 + [32-byte X coordinate] (if Y coordinate ...
Pieter Wuille's user avatar
7 votes
Accepted

Is there a way to convert a P2PKH address into P2TR?

Short answer: no, at least not via the key path (and using a script path would be less efficient than using P2WPKH instead) Longer answer: no, and even if it were possible, this would be a terrible ...
Pieter Wuille's user avatar
7 votes
Accepted

Will P2TR make P2WSH obsolete?

As far as I can tell, P2TR is better than P2WSH in almost every way. I cannot think of a case in which it would be a significant advantage to use P2WSH over P2TR, except that P2WSH is already ...
Murch's user avatar
  • 75.7k
7 votes
Accepted

Is a P2TR address a compressed public key?

Pay to Taproot uses x-only pubkeys. In Bitcoin, a private key d is a scalar, and its corresponding public key Q is the elliptic curve point found by multiplying d with the generator G of secp256k1: Q =...
Murch's user avatar
  • 75.7k
7 votes
Accepted

How to extract the internal key of a simple P2TR address?

A P2TR address encodes a public key using Bech32m, which you can directly decode. This public key is often (as recommended by BIP341) the result of taking a different key (called "internal key&...
Vojtěch Strnad's user avatar
5 votes
Accepted

Is taproot considered nonstandard to older clients?

P2TR outputs (and higher-version native witness outputs) are standard since Bitcoin Core v0.19: https://github.com/bitcoin/bitcoin/pull/15846 Inputs spending P2TR outputs are non-standard in all ...
Pieter Wuille's user avatar
5 votes
Accepted

P2TR: Is pub key hashed in address?

Public keys are not hashed in Taproot (SegWit v1). The Taproot (Merkle) tree in the script path uses hashes but the Merkle root of this tree tweaks the unhashed public key (internal key) and the ...
Michael Folkson's user avatar
5 votes

Is tweak used when spending from script path for Taproot?

You perform tweaking at signing time if the key you're signing for was tweaked. That's a decision that was made when the output was constructed, not when it is spent. Taproot outputs can consist of: ...
Pieter Wuille's user avatar
5 votes
Accepted

How can I tell if a Taproot input is a key path spend or a script path spend?

Taproot is specified in BIP341 which also includes much relevant information such as motivation and rationale. My answer will essentially just rephrase some of its highlights. Key path spends and ...
Vojtěch Strnad's user avatar
4 votes

tracking invoice address type migration

You can find the first on https://txstats.com/dashboard/db/utxo-set-repartition-by-output-type?orgId=1. For a version weighed by value you can look at the graphs of the individual output types on the ...
Pieter Wuille's user avatar
4 votes

How can I spend from a P2TR address on Signet with the Bitcoin Core wallet in 22.0?

This is a draft answer (incomplete). To get set up on Signet ie sync the Signet chain and claim some Signet Bitcoin, follow these instructions. (You can run a Signet node in parallel with your mainnet ...
Michael Folkson's user avatar
4 votes
Accepted

non-mandatory-script-verify-flag (Invalid Schnorr signature) when I try to send a P2TR tx on testnet

I finally managed to successfully send a correct P2TR tx to the network in testnet! I answer my own question so that maybe it could be helpful for other people struggling with the same problem. There ...
alemaz98's user avatar
  • 143
4 votes

How to identify P2TR output type?

I don't see why that scriptPubKey would be incorrectly marked as P2TR as it absolutely does not follow the expected pattern. BIP 341 is very unambiguous as to the script construction - it must be OP_1 ...
Ava Chow's user avatar
  • 70.8k
4 votes
Accepted

How is tapscript different than P2PKH using opcodes from a developer perspective?

It sounds like this means that I could do an ordinal in a non-taproot address bitcoin transaction. So I could mint an ordinal with a P2PKH address. Historically output types with address standards ...
Murch's user avatar
  • 75.7k
3 votes
Accepted

Issue when broadcasting Taproot transaction to older nodes

How am I supposed to broadcast a Taproot transaction to older nodes when they won't accept it? You can't. You need to broadcast it to new nodes for it to propagate.
Pieter Wuille's user avatar
3 votes
Accepted

What is the weight of a P2TR input?

TL;DR: A P2TR keypath input will weigh 57.5 vbytes. A P2TR scriptpath input will weigh a variable amount greater than that. Composition of a P2TR input Each input commits to spending a specific UTXO ...
Murch's user avatar
  • 75.7k
3 votes

Should the Bitcoin Core wallet (or any wallet) prevent users from sending funds to a Taproot address pre activation?

For a sender to send to a P2TR address pre activation they must have received that P2TR address from the receiver and so it would be an indirect safeguard to protect the receiver having given out P2TR ...
Michael Folkson's user avatar
3 votes
Accepted

Where can I find taproot spend examples on testnet/signet?

As Pieter said in the comments there are Taproot test vectors that have recently been merged into BIP 341. You can also find additional P2TR spends on signet, testnet on block explorers e.g. mempool....
Michael Folkson's user avatar
3 votes

Is Taproot the best address against quantum computers attack?

Schnorr signatures are proven to be secure and robust against chosen-message attacks in the random oracle model. In practice, this implies that as long as the condensation function behaves ideally, ...
Pegasus's user avatar
  • 121
3 votes

How can I create a multi sign for a large number of users

I'd expect the relevant constraint to be the 1000 witness stack item limit for P2TR inputs. This should permit a script specifying at most 999 public keys in an OP_CHECKSIG(ADD)-based construction (i....
Murch's user avatar
  • 75.7k

Only top scored, non community-wiki answers of a minimum length are eligible