19 votes
Accepted

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

Let's compare a 2-input and 2-output transaction for single-sig output types. I'll refer to the byte length of the transaction as "raw size" , the transaction without its witness data as &...
user avatar
  • 62.3k
9 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 ...
user avatar
  • 7,030
8 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 ...
user avatar
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 ...
user avatar
  • 6,169
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 ...
user avatar
  • 60.4k
4 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 ...
user avatar
  • 1,014
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-...
user avatar
  • 6,898
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 (...
user avatar
  • 9,769
3 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 ...
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 ...
user avatar
  • 4,996
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 ...
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 ...
user avatar
  • 2,413
2 votes
Accepted

Does my segwit node only have segwit blocks?

BIP 144 equipped nodes doesn't fetch blocks from old nodes since they are only capable of providing witness stripped blocks. If someone sent it a stripped block (e.g. by lying about their support or ...
user avatar
  • 7,429
2 votes
Accepted

What happens to witness blocks?

Pruned nodes forget blocks after a while after processing. However, this is independent from whether those blocks have a witness. SegWit does permit a half-pruned state, where witnesses are removed ...
user avatar
2 votes
Accepted

How much will Segwit *actually* increase bitcoin capacity for realistic transactions?

Note that the scriptSig field is not just the ECDSA signature itself (65 bytes) but also the public key in the case of a P2PKH input, or the redeem script for a P2SH input, and a couple more bytes for ...
user avatar
  • 11.3k
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. ...
user avatar
  • 6,898
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. (...
user avatar
  • 1,815
2 votes
Accepted

How does storing the witness outside of the block prevent malleability?

The data of the scriptSig is mooved from TransactionInput to RawTransaction, so the Raw transaction doesn't is malleability? maybe I can't imagine what really happened to non-witness transactions ...
user avatar
  • 16.4k
2 votes

What is "Witness"?

This is a transaction with three P2WPKH (native segwit v0 single-sig) inputs and a single P2WPKH output. For P2WPKH, the scriptPubKey (the locking script encoded in an output) contains a witness ...
user avatar
  • 62.3k
2 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 ...
user avatar
  • 60.4k
2 votes
Accepted

Generate P2WSH native

Bech32 encoding, apart from the checksum, is a simple matter of converting base-256 (8-bits) to base-32 (5-bits). Base-256 is the byte array (octet string) that you get from a hash function. Only ...
user avatar
2 votes

Re-index/Re-download from specific height?

A reindex will not redownload the block. However, after safely shutting down Bitcoin Core, you can delete the block file containing that block. When you start it again, you will need to reindex, but ...
user avatar
  • 60.4k
1 vote

Generate P2SH-P2WSH

At the time this question was asked, this issue was the result of a bug in Bitcoin Core. It was fixed in PR #18484 and is available in Bitcoin Core 0.20+.
user avatar
  • 60.4k
1 vote

How does storing the witness outside of the block prevent malleability?

Why the witness data is stored outside the block? what do you mean? I think I don't understand the sense of this space-saving because the witness data is present inside the blk file. The ...
user avatar
1 vote

How does a SegWit node verify a block?

For SegWit node, is witness necessary to verify a block? Because I know witness are committed as wtxid merkle node in coinbase. What's the purpose of the wtxid merkle node? If a block contains ...
user avatar
  • 60.4k

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