0

Since segregated witness is in place inside Bitcoin blockchain, my understanding is that witness data are no longer stored inside the blocks, so if blocks are linked to each other where theirs corresponding witness data are stored ? There is a parallel block chain ?

1

If the client is SegWit enabled, the full transaction including witness data can be stored in the same format as the transaction is received over the wire. There is no need for separate storage - it can all be included in the block.

If the client is not SegWit enabled, SegWit transactions are stripped of their witness and the witness marker/flag before sending/receiving, so these clients will not receive witness data, and therefore will not store it at all and will only use the legacy format.

This means the block storage between the two clients is different, but they are still sharing the same blockchain and transaction history.

Compatibility is made possible because even when SegWit is used and the witness is present, the SegWit client will calculate a txid by stripping the transaction back to its legacy format (removing the witness parts) before hashing. The txid is common between the SegWit and non-SegWit clients as a means to identify which transaction is being referred to. SegWit clients can identify data by a wtxid too, which is the hash of the serialized transaction with witness format - but this wtxid is not used as part of a txOutPoint to refer to a previous transaction - the txid is always used.

SegWit transactions are forward compatible with non-supporting software clients because the transaction with its witness data stripped from it appears as though it is an ANYONECANSPEND transaction - the stack is left with a non-zero value on top after evaluating the scriptPubKey, which is indicates successful evaluation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.