1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-01-18 21:35:13 +01:00

Embedded diagram

This commit is contained in:
Eric Lombrozo 2015-12-24 17:23:02 -05:00
parent 9b9a8c4b71
commit 0112d56051
2 changed files with 13 additions and 12 deletions

View File

@ -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<CTxIn>, vector<CTxOut>,
vector<CTxInWitness>, int32 nLockTime) instead of (int32 nVersion,
vector<CTxIn>, vector<CTxOut>, int32 nLockTime). This will never parse
<img src=bip-codeshark-segwit-peer-services/witnesstx.png></img>
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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB