9 votes
Accepted

Why are there 17 native segwit versions?

Segwit has 17 versions, because Script defines the constants OP_0–OP_16 explicitly, while any other numbers would need to be added to the output script with OP_PUSHDATA.
Murch's user avatar
  • 74.6k
8 votes
Accepted

Why are hashSequence and hashPrevouts computed separately?

The reason is increasing the ability to precompute and/or cache those hash values once for the whole transaction (potentially allowing them to be used for many signatures). In "normal" (...
Pieter Wuille's user avatar
6 votes
Accepted

What would happen if we provide witness program different than 32 bytes for SegWit 1?

SegWit version 1 outputs with lengths other than 32 bytes remain unencumbered, which means their validation is unchanged and they remain anyone-can-spend. From BIP341: A Taproot output is a native ...
Vojtěch Strnad's user avatar
5 votes
Accepted

What is considered witness data in SegWit?

This is defined in BIP141, section "Block size": Blocks are currently limited to 1,000,000 bytes (1MB) total size. We change this restriction as follows: Block weight is defined as Base ...
Vojtěch Strnad's user avatar
4 votes

Follow-up to Segwit: Arbitrary data storage in witness?

Pieter Wuille has answered the technical question of how these transactions are affected by the rules. Vojtěch Strnad identified the origin as Ordinals Inscriptions - a kind of NFT. When I asked &...
RedGrittyBrick's user avatar
4 votes
Accepted

Are contrived combinations of address format and segwit version program possible?

I wonder that I'm unable to see how exactly BIP 0341 forbids v1+ segwit from using bech32. BIP341 has nothing to do with this; it specifies consensus validation rules, not address encoding. BIP350 ...
Pieter Wuille's user avatar
4 votes

What is the purpose of P2WPKH-P2SH?

P2SH-P2WPKH addresses can only be created by segwit-compatible wallet software. However, sending to a P2SH-P2WPKH works with any P2SH-compatible wallet, as the address is indistinguishable from (and ...
Pieter Wuille's user avatar
4 votes

Why are some bc1 addresses 42 characters and others 62 characters in Base58?

P2WPKH (pay-to-witness-public-key-hash) addresses are 42 characters in length and P2WSH (pay-to-witness-script-hash) addresses are 62 characters in length (see here). bc1 addresses also use bech32 ...
Michael Folkson's user avatar
4 votes
Accepted

Are all transactions, whether SegWit or non-SegWit, part of the commitment in a coinbase transaction?

The wtxids of all transactions are committed to by the witness commitment tree in the coinbase transaction (except the coinbase wtxid itself, as that would be a cyclic dependency). This includes non-...
Pieter Wuille's user avatar
4 votes
Accepted

Is a BIP required for the removal of SegWit Discount for Inscriptions?

The removal of the witness discount would be a consensus change, specifically a soft fork. Changes to consensus rules have always been standardized as BIPs ever since the BIP process was created and I ...
Vojtěch Strnad's user avatar
3 votes
Accepted

How are the block header bytes treated when calculating the block size in weight?

Are these header bytes treated as non-segwit bytes, i.e. cost 4 WU, so we actually have 3,999,668 WU (4,000,000 - 320 WU for header - 12 WU for tx counter) for transactions? Yes. The header weighs ...
Pieter Wuille's user avatar
3 votes
Accepted

Does adding OP_1 to scriptSig create a fork between non-segWit and segWit nodes?

For any soft fork, it's possible for a block to contain a transaction violating the new consensus rules. Old nodes would accept this block and new nodes would refuse it. However as long as more than ...
Antoine Poinsot's user avatar
3 votes
Accepted

What do the following lines of code do in the context of sending Bitcoin?

You cannot go from just the address to the wallet's public key. There is a hash step involved which is irreversible. In the code example you're linking, this is not an issue, as it is code that is ...
Pieter Wuille's user avatar
3 votes
Accepted

What does it mean that BIP141 is "buried" in Bitcoin core?

The concept of a buried softfork deployment was introduced in BIP 90. In short, it means that the softfork's consensus rules are generally active on every block (possibly with a few known exceptions), ...
Pieter Wuille's user avatar
3 votes
Accepted

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

From BIP341: A Taproot output is a native SegWit output (see BIP141) with version number 1, and a 32-byte witness program. [...] Let q be the 32-byte array containing the witness program (the second ...
Vojtěch Strnad's user avatar
3 votes

How could a 2 byte witness program make sense?

Gregory Sanders proposed Segwit Ephemeral anchors, in which a 2-bytes witness program in a transaction's output to make it opt in to different relay rules (BIP, Optech).
Antoine Poinsot's user avatar
3 votes

SegWit Version - is there a proposal for new versions?

Taproot is implemented as SegWit version 1. Another proposed feature that would most likely be implemented as a new SegWit version is cross-input signature aggregation.
Vojtěch Strnad's user avatar
3 votes
Accepted

Bitcoin transaction malleability is it only for unconfirmed transaction?

TL;DR: Yes, once a transaction is confirmed, unless a chain reorganization makes it unconfirmed again, no forms of malleability are possible. SegWit specifically fixed TXID malleability of unconfirmed ...
Vojtěch Strnad's user avatar
3 votes
Accepted

What happens when we send MSG_WITNESS_TX/MSG_WITNESS_BLOCK to non-segWit node?

That would be a violation of BIP144. Support for segwit is signalled by having NODE_WITNESS in the services advertized in the version packet. If a peer does not signal NODE_WITNESS, it cannot be sent ...
Pieter Wuille's user avatar
3 votes

Accidently sent BTC to taproot wallet on Phantom. Wondering how i can get it back to Segwit so i can buy ordinals with it

Note that addresses are not accounts. The only way to move your coins to a different address (regardless of type) is to make a transaction. Presumably the wallet you are using allows you to send ...
Ava Chow's user avatar
  • 70.1k
3 votes
Accepted

What is the default private key type for legacy and segwit addresses?

The term "compressed private key" is a misnomer; it's not the private key that is compressed. Instead, it is an indication about whether the corresponding public key is to be in compressed (...
Pieter Wuille's user avatar
2 votes
Accepted

importmulti native segwit address to fetch utxos of p2wpkh native segwit address

For modern "descriptor" wallets, you need to convert whatever you want to import to the output descriptor language, and import that using the importdescriptors RPC. For an individual address,...
Pieter Wuille's user avatar
2 votes

Inscriptions with size less than 10Kb were seemingly possible before taproot, why did they become popular only now?

There's really no reason inscriptions couldn't have been done with SegWit v0. The only difference would be that large inscriptions would have to be split across multiple inputs, making the ...
Vojtěch Strnad's user avatar
2 votes

Inscriptions with size less than 10Kb were seemingly possible before taproot, why did they become popular only now?

With P2WSH, one could seemingly use the same script structure ("envelope") OP_FALSE OP_IF OP_ENDIF to store up to ~10Kb of data in witness This is incorrect. The maximum standard witness ...
Antoine Poinsot's user avatar
2 votes

Where exactly is the Inscription media stored in witness signature?

I think this is explained at https://docs.ordinals.com/inscriptions.html Inscription content is serialized using data pushes within unexecuted conditionals, called "envelopes". Envelopes ...
RedGrittyBrick's user avatar
2 votes
Accepted

Which value is appropriate for the MARKER field of a segwit tx messages: 0x00 or nonzero?

the marker would need to be 0 for old nodes to treat the transaction as valid. [...] Is there something I'm missing? What you may be missing is that old (pre-segwit) nodes never see segwit data, when ...
RedGrittyBrick's user avatar
2 votes
Accepted

What types of transaction malleability exist and which one of them does SegWit solve?

As you have identified, there are some inherent ways in which a transaction can be changed without changing its outcome. This is especially problematic when it changes the txid for its downstream ...
Murch's user avatar
  • 74.6k
2 votes
Accepted

How is segwit backward compatible (soft fork) when the transaction serialization structure is changed?

Old nodes never see the new serialisation format When an old node asks a new node for data, the new node edits the data into the old serialisation format before sending it
RedGrittyBrick's user avatar
2 votes
Accepted

Can a non-segwit transaction be serialized in the segwit format?

The extended serialization format introduced in BIP144, which is used for serializing witnesses, specifies: If the witness is empty, the old serialization format must be used. So, no, using the ...
Pieter Wuille's user avatar
2 votes

What is arbitrary witness data and unspent transaction output?

What is arbitrary witness data and unspent transaction output? [...] I'm confused what they mean by UTXO Arbitrary Arbitrary means what you think it does - "the data can be anything you choose&...
RedGrittyBrick's user avatar

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