Is a Segwit format transaction with all inputs of non-witness program sort legitimate?

TL;DR: no, that won’t be accepted, however not due to something in BIP141.

BIP141 specifies the segwit block and validity guidelines, nevertheless it does not specify how transactions must be serialized to bytes for communication (that’s in BIP144). So far as BIP141 is worried, transactions are summary objects (constructions containing inputs and outputs, witnesses and scripts, …), not sequences of bytes. On this view, each transaction (even pre-segwit transactions) has a witness for every enter, which can be empty. It doesn’t care whether or not you utilize the legacy transaction serialization format (with out marker/flag/witnesses) or the prolonged legacy transaction serialization format (with marker/flag/witnesses), or one thing else (say, a flowery compressed format for transactions). It simply cares about transactions.

Nonetheless, transactions, for validation purporses, do have have txids and wtxids, that are hashes of one thing. That one thing have to be well-defined, as txids and wtxids are related for consensus guidelines; in the event that they had been computed any in a different way by some nodes, they might fork off. It is for that reason that BIP141 mentions the serialization format for the needs of computing the wtxid. However, once more, it doesn’t care how that transaction is definitely despatched to the node. It simply states that if in case you have a transaction, how it’s best to compute its wtxid. The wtxid would possibly in idea not equal the hash of the byte serialization of the transaction as your node acquired them (although in follow, for now, it’s).

BIP144 does specify the peer to look protocol for communication of segwit transactions, which occurs to specify the identical encoding because the one utilized in BIP141 for the computation of wtxids. However it additionally consists of the road:

If the witness is empty, the outdated serialization format have to be used.

So, for the needs of the peer-to-peer protocol, you can not use the prolonged format when transmitting a transaction to a node that has all empty witnesses. As that is only a peer-to-peer protocol selection, it’s attainable in idea that in future peer-to-peer protocol extensions one other serialization format for transactions will get outlined, and if and when that occurs, the wtxid calculation in BIP141 will nonetheless apply precisely the identical, as a result of altering that half can be a consensus change.

Leave a Reply

Your email address will not be published. Required fields are marked *