Questions tagged [p2tr]

Pay to Taproot is the native SegWit v1 output format. It commits directly to a public key which can optionally be tweaked with the hash of a script tree. This combines capabilities of previous output formats which were usually based on either a public key hash or a script hash. P2TR addresses are Bech32m encoded and start with the prefix `bc1p`.

Filter by
Sorted by
Tagged with
0 votes
1 answer
46 views

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

I'm going to use ordinals as an example because they illustrate my question the most effectively. My understanding is that ordinals are created by writing opcodes into the transaction just like you ...
ChristianOConnor's user avatar
0 votes
1 answer
56 views

How can taproot transactions manage to store so much data?

I don't quite understand how ordinals are able to store so much data on chain. I know about the ordinals envelope. OP_FALSE OP_IF OP_PUSH "ord" OP_PUSH 1 OP_PUSH "text/plain;...
ChristianOConnor's user avatar
1 vote
1 answer
30 views

spending P2TR script path output using python bitcoinutils library

I am currently trying to spend a P2TR output using one of the scripts used to create the address. Below is the python code I tried to construct raw transaction in order to spend the UTXO. The address ...
paranoid's user avatar
0 votes
0 answers
26 views

Computing HASH160 of a Taproot X-only 32 byte Public Key

I know that Taproot does not use pubkey hashes, but I want to compute a HASH160 of a 32 byte Taproot X-only public key anyway. The rationale is to compare it to an existing 20 byte HASH160 from a ...
Alec Matusis's user avatar
1 vote
1 answer
73 views

How to identify P2TR output type?

The scriptpubkey alone can be used to identify the type of address. However, I'm debugging a library that's having difficulty differentiating the following transaction/scriptpubkey from a p2tr ...
arshbot's user avatar
  • 1,778
1 vote
0 answers
65 views

Issue with constructing a correct Schnorr Signature for a Taproot transaction

I'm experimenting with creating and sending Taproot transactions programmatically and encountered an issue with the Schnorr signature. I'm trying to send simple transaction with one V1_P2TR input and ...
Skwern's user avatar
  • 13
1 vote
1 answer
127 views

Are there plans to make a script invalid if there is more than one element left in the stack?

In BIP62, it was proposed to make a script invalid if there was more than one element left in the stack after execution. This proposal was eventually withdrawn. From what I read, some people have ...
mathboi's user avatar
  • 193
1 vote
1 answer
213 views

Unable to get Taproot address using bitcoinlib

I tried several ways to get a Taproot address from a Private Key with bitcoinlib, but I kept getting different addresses than those I get with Taproot wallets such as Unisat and OKX Wallet. Then, ...
Tprt's user avatar
  • 11
0 votes
1 answer
75 views

How is this P2TR transaction valid?

This Taproot transaction has 3 witness items which are initial stack for P2TR script. Execution of the tapscript goes something like this: push (4 items on the stack) checksig operation (results in ...
Cosmos's user avatar
  • 199
0 votes
1 answer
82 views

Enforcing PSBT Signature Rules: Finalizer/Extractor and Deserialization Implementation

Should PSBT finalizers/extractors and deserialization functions enforce the rule that a taproot schnorr signature should only append a SIGHASH_* unless it is SIGHASH_DEFAULT (0), or is it left to the ...
solar's user avatar
  • 25
1 vote
1 answer
66 views

Is it true that we don't care about parity with the key path, but it is not case with the script path? (Taproot)

I am reading materials related to the Taproot (specially, BIP341) and I know that there is two possible ways to spend the output: via key path via script path I also know that the Taproot output ...
LeaBit's user avatar
  • 930
2 votes
1 answer
118 views

non-mandatory-script-verify-flag (Invalid Schnorr signature) when trying to reveal a TR output

I'm building a Bitcoin wallet, and I'm trying to spend a Taproot output via a script spend path, but I keep running into this "Invalid Schnorr signature" error from my RPC node: { "...
Sherwin Li's user avatar
0 votes
2 answers
84 views

Why there duplicated transactions on the blockchain? (with different hashes)

I just found a couple of transactions that looks very similar, they have different hashes, but are exactly equal in everything else: 3d69534a43b4396faac62e84ba6092d539335dd1c6601da626020f69082280c1 (...
eloyesp's user avatar
  • 202
1 vote
1 answer
233 views

How to get signature for tweaked public key in P2TR in case of multiple signature?

EDIT: Can we just tweak the signature with the root MAST as well? As I understand, the public key in scriptPubKey for P2TR is obtained by tweaking (let's call it original public key) and the root of ...
LeaBit's user avatar
  • 930
1 vote
1 answer
234 views

What is the way to create public key in P2TR?

I've started learning Taproot and I'm having trouble understanding some of the general story behind how it works in the context of a public key in scriptPubKey. The segWit v1 (Taproot) scriptPubKey ...
LeaBit's user avatar
  • 930
1 vote
1 answer
94 views

What does CTxOut represent in BIP143 and BIP341?

The term CTxOut is mentioned several times in BIP143 and BIP341. However, I can't understand what it actually represents? I assume it's just the transaction output, but I am not sure and the confusion ...
dassd's user avatar
  • 1,069
2 votes
1 answer
271 views

"Witness program hash mismatch" code -26 when broadcasting a transaction

I'm trying to broadcast a transaction to my RPC provider: curl https://my-quicknode-rpc-provider/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"method": &...
Sherwin Li's user avatar
3 votes
1 answer
124 views

How do we create funny segwit v1 taproot bech32m addresses?

Look at what this user has broadcasted, destination addresses are interesting: bc1pjjjkkkklllllmmmmmmnnnnnnnpppppppqqqqqqqqqrrrrrrrrraq663x0t ...
Mercedes's user avatar
  • 802
0 votes
1 answer
59 views

Do we pay cheaper fees for less security in P2TR rather than P2PKH?

Answer quote: P2TR now is a spiritual successor of P2PK: it locks funds directly to a key and only requires a signature to spend the funds. If P2TR UTXOs are guarded by Schnorr signatures and P2PKH ...
Mercedes's user avatar
  • 802
2 votes
0 answers
31 views

Would exchanges save block space by defaulting deposit addresses to P2TR? [duplicate]

If inputs weigh less in P2TR than other address types, and exchanges conduct big batch transactions for withdrawals, is there a significant efficiency gain in block space they consume if most of their ...
Rex Everything's user avatar
2 votes
1 answer
182 views

How can I spend a mix of UTXOs (p2sh, p2wpkh, p2wsh) along with a p2tr UTXO?

I'm constructing a script to spend multiple distinct UTXOs in a single transaction. I've successfully combined all UTXOs except for two. Succeeding in spending a P2TR with P2PKH UTXO. I encountered a ...
Mohsen Haydari's user avatar
9 votes
1 answer
949 views

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

I have multiple times seen people argue that there is “no economic incentive” to switch from P2WPKH to P2TR. I know that the sum of input and output weight on P2WPKH and P2TR are very similar, but how ...
Murch's user avatar
  • 75.2k
6 votes
0 answers
149 views

Which wallets are spending P2TR with SIGHASH_ALL?

I noticed there are quite a lot of transactions spending taproot key path inputs that use SIGHASH_ALL instead of SIGHASH_DEFAULT in signatures (around 20% in the last two weeks). Recall that ...
Vojtěch Strnad's user avatar
3 votes
1 answer
393 views

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

In some analyses of chain activity, I sometimes see Taproot spends divided into key path and script path. Why are they called that? Which BIPs should I read to learn more? When I look at a P2TR tx in ...
Hunter Beast's user avatar
2 votes
0 answers
98 views

Is there a limit on the number and size of script inputs when spending a script path in a P2TR transaction?

From BIP 341, Spending using one of the scripts: A Taproot output can be spent by satisfying any of the scripts used in its construction. To do so, a witness stack consisting of the script's inputs, ...
Pramod Kandel's user avatar
2 votes
1 answer
187 views

Taproot Script Path Spending can't pass signature verification

I am trying to verify the witness of a P2TR transaction, but the signature verification failed, could you please help? The raw transaction: ...
lj zn's user avatar
  • 31
1 vote
1 answer
337 views

I get an Invalid Schnorr signature when trying to broadcast a taproot transaction

I have 0.00036134 testnet bitcoin at the segwit v1 address: tb1p3au39skpdd8suuhunr4ymp6ca6akv9keq20v5twuagpmyqntqaasl22f4w I wrote this script to achieve 2 things: archive a hash in a transaction and ...
ChristianOConnor's user avatar
2 votes
2 answers
728 views

Get the scriptPubKey from a Taproot address

I have this function that converts a Bitcoin private key as an integer to a public key and an address. def get_seg_v1_from_pkey(imported_key): imported_key_toint = int(imported_key) ...
ChristianOConnor's user avatar
3 votes
1 answer
275 views

How can I find the public key corresponding to a P2TR input?

Can you please tell me what is inside the Taproot Witness data? For P2WPKH, it is defined in BIP-0141 and we have: <signature> <pubkey> But for Taproot, I can't find anything similar. Per ...
Sina Sharifzade's user avatar
1 vote
0 answers
103 views

I get a not a P2TR scriptPubKey error when trying to generate a bech32m taproot compliant P2TR address with python

I have the following script that is supposed to derive a taproot P2TR address: from bitcointx import set_custom_secp256k1_path set_custom_secp256k1_path('./bitcointx_secp256k1_here/libsecp256k1.2....
ChristianOConnor's user avatar
3 votes
1 answer
96 views

Error creating a Taproot descriptor with a single key as script path

I need to implement 1 of 2 multisig with P2TR. My friend's Bitcoin public key is 0374d5f29bc6c15066437856c512f7f9e5a14a1eb93cab2776d33b27b4103c62d8. My own Bitcoin public key is ...
Wei's user avatar
  • 51
5 votes
1 answer
507 views

How do you construct witness stack and controlblock in P2TR Script Path outputs?

I have been documenting how to create different types of Tx outputs here, leveraging the Bitcoin Core Test Framework. Particularly for Taproot, I'm working on a scenario of a P2TR Script Path with a ...
Bitcoin_1o1's user avatar
4 votes
1 answer
899 views

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

Is it possible to extract the taproot internal key out of a P2TR address?
Orny's user avatar
  • 151
3 votes
1 answer
185 views

Validation of segwit v0-v1 tx automatically adds OP_CHECKSIG?

When I create a segwit transaction v0 (P2WPKH) or v1 (P2TR key-path spend) I do like that (let's spend a P2TR output): Locking Script (of the P2TR output I'm spending): OP_1 PK_size PK Witness: 1 (...
alemaz98's user avatar
  • 143
2 votes
1 answer
300 views

How to create a 1-of-2 multisig with P2TR?

We have two companies and we want to spend funds with 1-of-2 multisig. We successfully did such a multisig with P2SH. How can I do this in P2TR? Can any give me a detailed instruction step by step? ...
Wei's user avatar
  • 51
0 votes
2 answers
198 views

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

I want to create a DAO-like wallet where each member would have to sign for any given tx. Tx should go through if 51% of the users signed. Is this possible?
pxr_64's user avatar
  • 123
1 vote
2 answers
367 views

Is tweak used when spending from script path for Taproot?

I understand that a taproot output can be either spent using key path or script path. With key path, a tweak is applied to the private key and then sign the sighash. The signature is provided as a ...
Joy Wang's user avatar
6 votes
2 answers
1k views

Is a P2TR address a compressed public key?

From what I understand, a public key can be compressed from 64 bytes into 32 bytes, but an additional byte is needed for the sign, so it usually winds up being 33 bytes total. But P2TR addresses only ...
Hunter Beast's user avatar
2 votes
1 answer
195 views

Error validating transaction: unexpected witness payload for non-witness script in a P2TR using script path

I am trying to create a raw transaction P2TR, spending a Taproot UTXO using the script path. I did the following: Create a random private key d and corresponding pubkey P (the internal pubkey) ...
alemaz98's user avatar
  • 143
4 votes
1 answer
1k views

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

I'm learning to create tx from scratch in order to understand better how bitcoin tx works and how they are structured. I learnt to create tx with legacy address, segwit v0 and I am now learning ...
alemaz98's user avatar
  • 143
1 vote
1 answer
168 views

How to choose a nothing-up-my-sleeve (NUMS) point on secp256k1 for use in Taproot?

Per BIP-341, if you want to create a Taproot output that is only spendable via the script-path spend (and not a key-path spend), you must "pick as internal key a point with unknown discrete ...
James O'Beirne's user avatar
0 votes
2 answers
255 views

Is Taproot the best address against quantum computers attack?

I'm looking for an address type for long term storage of bitcoin but I don't know what to choose. I'm not sure if Taproot is more secure than segwit. Another question I have about Taproot, is that if ...
Dodi Alf's user avatar
4 votes
1 answer
310 views

How to spend an imported rawtr() descriptor with bitcoin-cli?

I created a transaction that creates a taproot output that can be spent using the private key (KEY) corresponding to the taproot output key. Then I imported the WIF formatted private key into Bitcoin ...
raphjaph's user avatar
0 votes
1 answer
140 views

What are the last bytes for in a taproot script-path sighash?

I am trying to follow BIP341 to understand the signature hash calculation for taproot script path spends. From the bitcoin testing framework code, I see that if the transaction is spending from a ...
Darius's user avatar
  • 789
1 vote
2 answers
175 views

Can one infer the multisig status of a P2TR spend?

Given raw transaction input/output data, is it possible to know if a Taproot output is multisig or not? I'm getting raw block data from a bitcoin node, and want to classify each spend according to the ...
Bryan Oliveira's user avatar
1 vote
1 answer
225 views

What would happen if you tweaked a public key with an odd y-coordinate?

From BIP341 this example code shows how you can tweak an x-only pubkey: def taproot_tweak_pubkey(pubkey, h): t = int_from_bytes(tagged_hash("TapTweak", pubkey + h)) if t >= ...
Darius's user avatar
  • 789
2 votes
2 answers
430 views

How do you calculate a taproot sighash?

I'm having trouble manually recreating the taproot sighash from the example below. I used btcdeb to pass in an input transaction (with a P2TR output), and a valid tx that spends from it. In the logs ...
Darius's user avatar
  • 789
6 votes
1 answer
436 views

What is the largest multisig quorum currently possible?

Bitcoin script allows for a UTXO to be (un)encumbered by an N-of-N signature. When N is 1, this is referred to as a single signature. What are the limits of N for this application? What is the ...
Matthias's user avatar
9 votes
1 answer
552 views

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

Consider BIP-341 "Constructing and spending Taproot outputs" where it says If the spending conditions do not require a script path, the output key should commit to an unspendable script ...
davidbak's user avatar
  • 261
4 votes
1 answer
392 views

Which wallets or libraries besides core support (or will support) P2TR descriptors?

I want to help test the WIP Bitcoin Dev Kit "Add support for Taproot and tr() descriptors", PR #593 against other implementations besides Bitcoin Core (already testing again Core 22.0). In ...
Not Mandatory's user avatar