<p>When forwarding the block to a non-segwit peer, a segwit-enabled node strips the witness data from the block before transmission, including <code>marker</code> and <code>flag</code>. Note that the stripped blocks still enable the non-segwit peers to arrive at the same UTXO set, since the stripped transactions specify which inputs get spent and which new outputs get created.</p>
<p>If a segwit-enabled node were to receive a stripped block, it would consider the block invalid due to the missing witness data on transactions with segwit inputs (and the presence of a witness commitment). Thus, a segwit-enabled node will not requests blocks from non-segwit peers as they wouldn't be able to provide the complete block anyway (unless the block had no segwit transactions and no witness commitment).</p>
<p>Segwit inputs were designed so that non-segwit nodes consider segwit transactions valid but non-standard. Non-standard transactions are not accepted into the mempool and thus not relayed. This means that non-segwit nodes will not relay (stripped) segwit transactions except in the context of a new block. In turn, this makes it safe for segwit nodes to request transaction inventory offered by non-segwit peers, since non-segwit peers will only offer non-segwit transactions.</p>

CC BY-SA 4.0
2023-09-17T01:21:13.113Z
Amazing answer Murch. Just one question. Are blocks that are valid but **contain non-standard transactions** relayed to other peers? That is, the concept of "standardness" exists only in the case of transactions and their relaying. For blocks, the only rule is: block is valid = relay, otherwise not?
dassd
CC BY-SA 4.0
2023-09-17T16:27:18.240Z
Yes, "standardness" is a term that refers to mempool policy. Blocks are always propagated. Everyone must get every block in order to synchronize with the network. Of course, segwit nodes propagate the complete block, while they would serve only a stripped block to non-segwit nodes, and non-segwit nodes would propagate a stripped block among each other. ("Stripped" here referring to a block stripped of witness data.)
Murch
CC BY-SA 4.0
2023-09-17T23:12:47.383Z
And only valid blocks are propagated while invalid blocks are rejected by the node and not relayed/propagated to other nodes? (I mean, that's the only that makes sense to me, just wanna be sure)
dassd
CC BY-SA 4.0
2023-09-19T11:02:31.050Z
Correct, when a node receives an invalid block it will discard it.
Murch
CC BY-SA 4.0
2019-11-12T23:30:15.190Z
2021-01-26T23:39:11.283Z
2021-01-26T23:39:11.283Z
Murch
<p>I've read all the relevant BIPs, and am still confused.</p>

<p>Are segwit enabled blocks stripped of witness data and marker and flag bytes when they are propagated to non-segwit peers? Or are they just serialized in such a way as to ignore the those bytes? </p>

<p>It is my understanding that blocks containing segwit transactions may have the witnesses, flag, and version bytes in them, or may not - depending on where that block is being propagated from. If it is coming from a non-segwit node, the transactions will be stripped. However, what happens when a stripped-witness block then reaches a Segwit-enabled node? How will it know that those transactions are actually segwit and are just missing the relevant data? Do they compare the txid's to txids in their cache and fill in the data?</p>

<p>Follow up question: what is the process/flow for individual transaction messages? Do their contents also depend on what type of node is asking for them?</p>

<segregated-witness><relay>
Parsing stripped-witness blocks
Mason
# Parsing stripped-witness blocks

(Asked by: username_0 on 2019-11-12)

I've read all the relevant BIPs, and am still confused.

Are segwit enabled blocks stripped of witness data and marker and flag bytes when they are propagated to non-segwit peers? Or are they just serialized in such a way as to ignore the those bytes?

It is my understanding that blocks containing segwit transactions may have the witnesses, flag, and version bytes in them, or may not - depending on where that block is being propagated from. If it is coming from a non-segwit node, the transactions will be stripped. However, what happens when a stripped-witness block then reaches a Segwit-enabled node? How will it know that those transactions are actually segwit and are just missing the relevant data? Do they compare the txid's to txids in their cache and fill in the data?

Follow up question: what is the process/flow for individual transaction messages? Do their contents also depend on what type of node is asking for them?

**Tags:** segregated-witness, relay


---

## 1 answers

### Answer by username_1 on 2019-11-12. Score: 4 | Accepted answer

When forwarding the block to a non-segwit peer, a segwit-enabled node strips the witness data from the block before transmission, including `marker` and `flag`. Note that the stripped blocks still enable the non-segwit peers to arrive at the same UTXO set, since the stripped transactions specify which inputs get spent and which new outputs get created.

If a segwit-enabled node were to receive a stripped block, it would consider the block invalid due to the missing witness data on transactions with segwit inputs (and the presence of a witness commitment). Thus, a segwit-enabled node will not requests blocks from non-segwit peers as they wouldn't be able to provide the complete block anyway (unless the block had no segwit transactions and no witness commitment).

Segwit inputs were designed so that non-segwit nodes consider segwit transactions valid but non-standard. Non-standard transactions are not accepted into the mempool and thus not relayed. This means that non-segwit nodes will not relay (stripped) segwit transactions except in the context of a new block. In turn, this makes it safe for segwit nodes to request transaction inventory offered by non-segwit peers, since non-segwit peers will only offer non-segwit transactions.

> **Comments:**
> **username_2**: Amazing answer username_1. Just one question. Are blocks that are valid but **contain non-standard transactions** relayed to other peers? That is, the concept of "standardness" exists only in the case of transactions and their relaying. For blocks, the only rule is: block is valid = relay, otherwise not?  
> **username_1**: Yes, "standardness" is a term that refers to mempool policy. Blocks are always propagated. Everyone must get every block in order to synchronize with the network. Of course, segwit nodes propagate the complete block, while they would serve only a stripped block to non-segwit nodes, and non-segwit nodes would propagate a stripped block among each other. ("Stripped" here referring to a block stripped of witness data.)  
> **username_2**: And only valid blocks are propagated while invalid blocks are rejected by the node and not relayed/propagated to other nodes? (I mean, that's the only that makes sense to me, just wanna be sure)  
> **username_1**: Correct, when a node receives an invalid block it will discard it.  

---

