diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index 6f33378c..c81e1dbb 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -15,9 +15,9 @@ This BIP defines new messages and serialization formats for propagation of trans ==Specification== -A new message type called "witnesstx" is added to the peer-to-peer protocol. (http://blockhawk.net/diagrams/witnesstx.png) +A new serialization format for tx messages is added to the peer-to-peer protocol. -The message has the following structure: +The serialization has the following structure: {| class="wikitable" style="width: auto; text-align: center; font-size: smaller; table-layout: fixed;" !Field Size @@ -71,16 +71,17 @@ The message has the following structure: | The block number or timestamp until which the transaction is locked |} -* CTransaction gets, in addition to vin and vout, a vwit, which -contains a CTxInWitness object for each input. A CTxInWitness contains a CScriptWitness object -and can potentially be extended to contain other kinds of witness data. -A CScriptWitness is a vector of byte vectors (nominally: the input stack to the program, no longer -encoded as a CScript, but just the resulting stack directly). -* A new serialization for CTransaction is defined: http://blockhawk.net/diagrams/witnesstx.png -(int32 nVersion, -0x00 marker, 0x01 flag, vector, vector, -vector, int32 nLockTime) instead of (int32 nVersion, -vector, vector, int32 nLockTime). This will never parse + + +Parsers supporting this BIP will be able to distinguish between the old serialization format (without the witnesses) and this one. The marker byte is set to zero so that this structure will never parse as a valid transaction in a parser that does not support this BIP. If parsing were to succeeded, such a transaction would contain no inputs and a single output. + +If all witnesses are empty, the old serialization format should be used. + +Witness objects can potentially be extended to contain other kinds of witness data. + +A script witness is a vector of byte vectors (nominally: the input stack to the program, no longer +encoded as a scriptSig, but just the resulting stack directly). + as a valid transaction (even if parsing succeeds, it means it's interpreted as a transaction with no inputs and 1 output). If all witnesses are empty, the old serialization format is used. diff --git a/bip-codeshark-segwit-peer-services/witnesstx.png b/bip-codeshark-segwit-peer-services/witnesstx.png new file mode 100644 index 00000000..5fd8afcb Binary files /dev/null and b/bip-codeshark-segwit-peer-services/witnesstx.png differ