21 votes
Accepted

How do virtual size, stripped size and raw size compare between legacy address formats and native segwit?

Segwit introduced a new limit for blocks, the blockweight limit, superseding the previous blocksize limit. Under the segwit rules, witness data is counted at a lower weighting than non-witness data ...
Murch's user avatar
  • 72.8k
14 votes
Accepted

Why is witness data downloaded during IBD in prune mode?

Why do pruned nodes download (segregated) witness data during IBD if much of that data is marked as Assumevalid? Good question, probably because nobody implemented it. Honestly, I had never ...
Pieter Wuille's user avatar
13 votes
Accepted

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

Am I understanding this correctly? Yes. will this transaction have failed the normal rules in Bitcoin Core for relaying transactions It's a P2TR (taproot) spend. Those spends have different policy ...
Pieter Wuille's user avatar
10 votes
Accepted

Redeem script. script hash, witness script and witness program

The scriptPubKey is the script as it is placed in the transaction output. The redeemScript (P2SH only) is the script pushed as the last scriptSig item. In P2SH scripts, the scriptPubKey is equal to ...
Pieter Wuille's user avatar
10 votes
Accepted

What is the Witness and what data does it contain?

This structure contains data required to check transaction validity but not required to determine transaction effects. In particular, scripts and signatures are moved into this new structure. The ...
JBaczuk's user avatar
  • 7,318
6 votes
Accepted

Would signature aggregation reduce the largest feasible blocksize

SegWit blocks aren't limited in bytes anymore but rather in weight. The maximum weight for a block is 4M. The weight of non-witness data is 4x its number of bytes. So, yes, decreasing the amount of ...
Jannes's user avatar
  • 6,324
6 votes
Accepted

Concept of Block weight and segwit are still unclear

Have a look: https://blockchair.com/bitcoin/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a Size = 1,158,038 bytes Weight units = 3,992,825 WU Now what does it mean? So the ...
Wapac's user avatar
  • 1,074
5 votes

Why is witness data downloaded during IBD in prune mode?

This was described in the "Segregated Witness Benefits" article on bitcoincore.org (from Jan 2016, prior to Segwit's activation): Efficiency gains when not verifying signatures Signatures ...
shesek's user avatar
  • 666
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
Accepted

Segwit: Arbitrary data storage in witness?

Your transaction, although not invalid, is non-standard. Since it is non-standard, it will not be propagated and will be rejected for being non-standard. However this does not mean that it cannot be ...
Andrew Chow's user avatar
  • 68.5k
4 votes

What is the Witness and what data does it contain?

For the segwit variants of an output (P2PKH becomes P2WPKH and P2SH becomes P2WSH), the witness contains the same data that would be found in the scriptSig. For P2PKH, in the scriptSig, you would have ...
Andrew Chow's user avatar
  • 68.5k
4 votes
Accepted

Where is the witness data stored in the raw block data

If your question is about how witness data is transmitted to other peers in the P2P protocol, the right place to look is BIP-144; the P2P side of the segwit specification. In short, the witness data ...
Pieter Wuille's user avatar
4 votes
Accepted

Confusion about Addresses

6 types of Bitcoin addresses (in parentheses are the data they keep): Legacy P2PKH 1... (a public key's hash) P2SH 3... (a script's hash) (defined in BIP16) SegWit (P2WPKH/P2WSH) nested in P2SH (...
MCCCS's user avatar
  • 10.1k
4 votes
Accepted

Why does a same transaction signed separately have different witness values?

Bitcoin signatures have two components: s and R. To sign a Bitcoin transaction with private key k, the signing algorithm generates an ephemeral private key r. The R component of the signature is the x-...
Ugam Kamat's user avatar
  • 7,348
4 votes
Accepted

How do I determine whether an input or output is segwit? - revisited

The way the BIP141 segwit rules consider transactions is simply that every transaction input (even non-segwit ones) have a witness stack. Non-segwit inputs are required to have an empty witness stack ...
Pieter Wuille's user avatar
4 votes

Is a transaction with a non-segwit input STILL considered malleable? If so how?

I think you are conflating two types of malleability: The first one is txid malleability of a presigned transaction: two (or more) parties can't trustlessly build a chain of unconfirmed transactions ...
Antoine Poinsot's user avatar
4 votes

Asumming a quantum computer gets deployed. Is it safe to prune the witness area and make blocks 1MB again?

Can we prune the witness area to save space You can so do today already, with a pruned node. It precludes the ability to let other post-segwit nodes synchronize from you, and loses the ability to ...
Pieter Wuille's user avatar
4 votes

How can I tell from the `getrawtransaction` if a transaction signaled Taproot?

It is still not clear to me what tx version number a Taproot transaction uses. Any transaction version number can have Taproot inputs or outputs. Is there a way to know via the ins (via ...
Pieter Wuille's user avatar
3 votes

What is the Witness and what data does it contain?

additional to JBaczuk and Andrew Chow, here is a detailed tx decoding. This is a mixed transaction, with three "normal" inputs, and a 4th segwit type input (TX_IN[3]). Therefor after the version field ...
pebwindkraft's user avatar
  • 5,086
3 votes
Accepted

How is the witness reserved value set in a coinbase transaction?

The only constraint on this value is that it must be 32 bytes. Otherwise there are no constraints. This is done to allow for a future soft fork to commit to new data and have non-upgraded nodes still ...
Andrew Chow's user avatar
  • 68.5k
3 votes

Calculating the witness size of a transaction

Will a loop through the "txinwitness" array of hex and do a byte length calculation on every one be enough? That is not enough as there are extra data in witnesses that is not included in the ...
Andrew Chow's user avatar
  • 68.5k
3 votes

What is the weight of a block that contains no pay-to-witness scripts?

From BIP 144: If the witness is empty, the old serialization format should be used. It is illegal to encode a transaction using the extended serialization format if the witness is empty. Another way ...
Pieter Wuille's user avatar
3 votes
Accepted

What is the weight of a block that contains no pay-to-witness scripts?

The witness serialization format only applies to transactions that have witnesses. If a transaction does not have witnesses, then its witness serialization format is the non-witness serialization ...
Andrew Chow's user avatar
  • 68.5k
3 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
3 votes

Is a transaction with a non-segwit input STILL considered malleable? If so how?

The status of BIP146 is “withdrawn”. Even for segwit inputs, high-s ECDSA signatures are only non-standard but consensus valid. I don’t know about the other malleability issues in detail, but would ...
Murch's user avatar
  • 72.8k
2 votes
Accepted

How to generate an output address from output scrips which start with 0x00?

It's a native segwit output. 0x00 signifies the segwit version (which is v0 in this case), 0x14 is the bytes to push and 2f82e61a98eb7027672760c691784d5fbccf7ce3 is the hash160 of the public key. ...
Ugam Kamat's user avatar
  • 7,348
2 votes

How do virtual size, stripped size and raw size compare between legacy address formats and native segwit?

I compared to the following 9 types of transaction's weight. And then I found that No9 (P2WPKH => P2WPKH) was the lightest. Transaction patterns // 1 transaction consists of 1 txin and 1 txout 1. (...
zono's user avatar
  • 1,915
2 votes

Why is the wtxid considered malleable?

To add to James' answer, the "segregated" witness can be switched out for an alternative valid witness which changes the wtxid but not the txid. The txid stays the same if you change the ...
Michael Folkson's user avatar
2 votes
Accepted

Why is the wtxid considered malleable?

All transaction data is committed to the WTXID, unlike in the case of TXID's. Malleability is found in the unlocking script/data of a transaction. It is malleable, because is not committed to the ...
James C.'s user avatar
  • 2,501
2 votes
Accepted

Calculating the witness size of a transaction

Elaborating on Andrew's answer: You can calculate it from size and vsize. Transaction size See BIP141 Transaction weight is defined as Base transaction size * 3 + Total transaction size (ie. ...
JBaczuk's user avatar
  • 7,318

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