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?


When forwarding the block to a non-segwit peer, a segwit-enabled node strips the block before transmission.

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. However, a segwit-enabled node will never request blocks from legacy peers as they wouldn't be able to provide a complete block anyway (unless the block had no segwit transactions and no witness commitment).

The same is true for transaction relay: a segwit-enabled node will recognize from the handshake that it is communicating with a non-segwit peer and send stripped transactions instead of complete transactions. Segwit-enabled nodes will not ask non-segwit peers for transaction data.

  • Marker and flag bytes are stripped too, correct? – Mason Nov 19 '19 at 19:50
  • Yes, marker and flag are part of the witness data. – Murch Nov 19 '19 at 21:12
  • Then what benefit does the legacy node even get by receiving a stripped transaction? Will they try and include it in blocks? – Mason Nov 19 '19 at 21:25
  • Lets say im trying to cache tons of transactions by txid, and im receiving them from both segwit and legacy nodes. I'm going to have an issue where depending on which type I receive first, I may have stripped transactions and witness transactions, correct? – Mason Nov 19 '19 at 21:26
  • I guess, but you could simply overwrite with the full transaction when you receive that on your full node. If you need the stripped transactions for some reasons, you can easily calculate them from the complete transactions. Why would you even want to run a pre-segwit node that only enforces a subset of the consensus rules? What are you trying to do? Your line of questioning seems fairly hypothetical or academic. – Murch Nov 19 '19 at 21:42

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.