Technically speaking, the witness data is not in the blockchain.
If the witness data is not in the blockchain, where is it? I thought you said it is in the OP_RETURN.
The OP_RETURN contains the hash of the witness data not the witness data itself.
It is sent separately alongside of the blocks.
Do you mean alongside the txs, prior to being in a block?
If you are familiar with alt-coins that are using the bitcoin blockchain, it is a similar principle. You have data
(here it's the witness data) that is transmitted aside from the blockchain. However, in order to prove that
data authentic, its hash is included in the blockchain.
However, the blocks must have some way to reference the witness block, and they do that by including the hash of the witnesses in the coinbase transaction.
Why do blocks need to reference the witness block? when a block is formed, isn't all txs within that block proved to be signed properly?
What do you mean coinbase transaction? I thought that is the block reward (currently 25btc).
This one, I'm unclear myself. It seems to me that it's a nice to have - but not a requirement. Every transaction is either signed directly and its signature included
in the blockchain (normal case) or in the witness data. If you are interested in verifying signatures, you have to download the witness data. Once you have it,
I believe you could verify every transaction in two steps:
1. the signature is correct
2. the hash of the witness data is equal to the value in the OP_RETURN
Before:
Tx in blockchain:
- Inputs: [Pubkey, Signature]
After
Tx in blockchain:
- Inputs: [Hash of [Pubkey] ]
Tx in segwit data: [PubKey, Signature]
There are other cases too but at first approximation, I hope this helps.
The coinbase tx is the block reward so technically it doesn't have need any input. However, the bitcoin protocol uses its inputs in a special way. It is like an
extension to the block header, but putting data there keeps the header short and can be done by a soft-fork.