1
1
According to bip 141, the segwit transaction serialization format (used to compute the wtxid) is:
[nVersion][marker][flag][txins][txouts][witness][nLockTime]
The bip mentions that the flag field MUST currently be 0x01. What's the purpose of this field? Is it some kind of upgrading mechanism of the serialization format?
I still don't fully understand. The 0x00 marker already prevents parsing by non-witness aware nodes. I suppose the 0x01 flag individual bits can signal inclusion of future data, such as prevouts? So up to 7 additional "data types" which can be included? Also, this data would be non-committed to the merkle root, but committed to the witness root hash, yes? – James C. – 2019-01-28T07:28:03.630
2@James C. All correct. It's intended for future extensibility with other types of witness data. Such new witnesses would need their own new witness commitments in the coinbase as well, as the existing wtxid would not cover them. – Pieter Wuille – 2019-01-29T09:44:16.307
@PieterWuille Perfect, I will look at how this is parsed again in the implementation, I didn’t think about new “wtxid” being required, but logical, thx! – James C. – 2019-01-29T09:49:33.520