From 9b9a8c4b71317afb946ef5198836df31914ed6f9 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Thu, 24 Dec 2015 14:23:27 -0500 Subject: [PATCH 01/11] Segregated Witness Peer Services BIP --- bip-codeshark-segwit-peer-services.mediawiki | 340 +++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 bip-codeshark-segwit-peer-services.mediawiki diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki new file mode 100644 index 00000000..6f33378c --- /dev/null +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -0,0 +1,340 @@ +
+  BIP: x
+  Title: Segregated Witness (Peer Services)
+  Authors: Eric Lombrozo , Pieter Wuille 
+  Status: Draft
+  Type: Standards Track
+  Created: 2015-12
+
+ +==Abstract== + +This BIP defines new messages and serialization formats for propagation of transactions and blocks committing to segregated witness structures. + +==Motivation== + +==Specification== + +A new message type called "witnesstx" is added to the peer-to-peer protocol. (http://blockhawk.net/diagrams/witnesstx.png) + +The message has the following structure: + +{| class="wikitable" style="width: auto; text-align: center; font-size: smaller; table-layout: fixed;" +!Field Size +!Name +!Type +!Description +|- +| 4 +| version +| int32_t +| Transaction data format version +|- +| 1 +| marker +| char +| Must be zero +|- +| 1 +| flag +| char +| Must be nonzero +|- +| 1+ +| txin_count +| var_int +| Number of transaction inputs +|- +| 41+ +| txins +| txin[] +| A list of one or more transaction inputs +|- +| 1+ +| txout_count +| var_int +| Number of transaction outputs +|- +| 9+ +| txouts +| txouts[] +| A list of one or more transaction outputs +|- +| +| txin_witness +| txin_witness +| Transaction input witness +|- +| 4 +| lock_time +| uint32_t +| 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 +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. +- Rationale for not having an independent CWitnessTransaction with +its own serialization: this would require separate "tx" and "block" +messages, and all RPC calls operating on raw transactions would need +to be duplicated, or need inefficinent or nondeterministic guesswork +to know which type is to be used. +- Rationale for not using just a single 0x00 byte as marker: that +would lead to empty transactions (no inputs, no outputs, which are +used in some tests) to be interpreted as new serialized data. +- Rationale for the 0x01 flag byte in between: this will allow us to +easily add more extra non-committed data to transactions (like txouts +being spent, ...). It can be interpreted as a bitvector. + +* A new message 'havewitness' is sent after receiving 'verack' to +indicate that a node can provide witness if requested (similar to +'sendheaders') + +* New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only +for use in getdata. Inv itself still use just MSG_TX and MSG_BLOCK, +similar to MSG_FILTERED_BLOCK. +- Rationale for not advertizing witnessness in invs: we don't always +use invs anymore (with 'sendheaders' BIP 130), plus it's not useful: +implicitly, every transaction and block have a witness, old ones just +have empty ones. + +* Transactions' GetHash is always computed on the old non-witness +serialization. A new CTransaction::GetWitnessHash is added which is +computed from the witness-serialization (this means that transactions +with an empty witness have witness hash equal to normal hash). + + +=== Commitment structure === + +!!!DRAFT ONLY!!! + +A new block rule is added which requires a commitment to the witness hashes in the coinbase (or an OP_RETURN output of a specific transaction, or somewhere else) + +(Hardfork after x year to move the commitment to block header?) + +Witness hash is the double SHA256 of a transaction including witnesses: http://blockhawk.net/diagrams/witnesstx.png. For the coinbase transaction, its witness hash is assumed to be 0x0000....0000. + +A witness root hash is calculated with all those witness hashes as leaves, in a way similar to the hashMerkleRoot in the block header. + +No witness data is allowed in blocks that don't commit to witness data, as this would otherwise leave room from spam. + +==== Proposal 1: balance tree (the current implementation) ==== +The commitment is a push of exactly 41 bytes: +*The first 4 bytes are commitment header: 0xaa21a9ed +*The next 4 bytes describe a nonce +*The next 1 byte is the "levels bytes", describes the number of levels in a Merkle tree (0 to 32) +*The next 32 bytes is a commitment root hash (not the witness root hash) + +Locator of the witness root hash is defined as: + +
SHA256('WitnessV1\x00\x00\x00\x00\x00\x00\x00' || nonce)
+ +The first levels bits of locator, interpreted in little endian, are assumed to be the position in the leaves of the Merkle tree where the witness root hash goes. + +The coinbase's input's witness must consist of a single byte array of 32 * levels bytes, and are assumed to be the Merkle path to connect the witness root hash to the commitment root hash. + +====Proposal 2: imbalance tree==== +The commitment is a push of exactly 40 bytes: +*The first 4 bytes are commitment header: 0xaa21a9ed +*The next 4 bytes describe a nonce +*The next 32 bytes is a commitment root hash (not the witness root hash) + +Locator of the witness root hash is defined as: + +
SHA256('WitnessV1\x00\x00\x00\x00\x00\x00\x00' || nonce)
+ +The first levels bits of locator, interpreted in little endian, are assumed to be the position in the leaves of the Merkle tree where the witness root hash goes. + +The coinbase's input's witness must consist of a single byte array, which the size must be a multiple of 32 bytes but not bigger than 32*32 bytes. These are assumed to be the Merkle path to connect the witness root hash to the commitment root hash. Depth of the commitment is determined by the length of the path. If the depth of the tree is 0, the path should be represented by 0x00, and the witness root hash will be same as the commitment root hash. + +=== Block size limit === +Blocks are currently limited to 1 MB total size. We change this restriction as follows: + +We define a base block size sb consisting of the existing header and transactions, a witness size sw consisting of only the size of the witness data, and a virtual block size sv = sb + sw/4. + +The new rule is sv <= 1 MB. + +=== Witness program === + +* A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a single push of 2 to 41 bytes gets a new special meaning. The byte vector pushed by it is called the "witness program". +** In case the scriptPubKey pushes a witness program directly, the scriptSig must be exactly empty. +** In case the redeemScript pushes a witness program, the scriptSig must be exactly the single push of the redeemScript. + +* The first byte of a witness program is the "version byte", an unsigned integer. +** If the version byte is 0, the rest of the witness program is the actual script. +*** The script is executed after normal script evaluation but with data from the witness rather than the scriptSig. +*** The program must not fail, and result in exactly a single TRUE on the stack. +** If the version byte is 1, the rest of the witness program must be 32 bytes, as a SHA256 hash of the actual script. +*** The witness must consist of an input stack to feed to the program, followed by the serialized program. +*** The serialized program is popped off the initial witness stack. Hash of the serialized program must match the hash pushed in the witness program. +*** The serialized program is deserialized, and executed after normal script evaluation with the remaining witness stack. +*** The script must not fail, and result in exactly a single TRUE on the stack. +** If the witness version byte is 2 or above, no further interpretation of the witness program or witness happens. + +=== Other consensus critical constraints === + +== Block size analysis == +WORK IN PROGRESS + +Definitions: +
+ Core block size (CBS): The block size as seen by a non-upgrading full node
+ Witness size (WS): The total size of witness data in a block
+ Total block size (TBS): CBS + WS
+ Witness discount (WD): A discount factor for witness data in VBS calculation (1 = no discount)
+ Virtual block size (VBS): CBS + (WS * WD)
+ Witness adoption (WA): Proportion (in size) of new format transactions among all transactions
+ Prunable ratio (PR): Proportion of signature data size in a transaction
+
+ +With some transformation it could be shown that: +
+ TBS = CBS / (1 - WA * PR)
+     = VBS / (1 - WA * PR * (1 - WD))
+
+ +In order to keep the proposal as a soft fork, the CBS must not have a upper limit higher than 1MB. + +The PR heavily depends on the transaction script type and input-output ratio. For example, the PR of 1-in 2-out P2PKH and 1-in 1-out 2-of-2 multisig P2SH are about 47% and 72% respectively. According to the data presented by Pieter Wuille on 7 December 2015, the current average PR on the blockchain is about 60%. + + + +== Examples == + +=== Version 0 witness program === + +The following example is a version 0 witness program, equivalent to the existing Pay-to-Pubkey-Hash (P2PKH) output. + + witness: + scriptSig: (empty) + scriptPubKey: <0x0076A914{20-byte-hash-value}88AC> + +The version byte 0x00 is removed. The rest of the witness program is deserialized and becomes: + + DUP HASH160 <20byte-hash-value> EQUALVERIFY CHECKSIG + +The script is executed with the data from witness + + DUP HASH160 <20byte-hash-value> EQUALVERIFY CHECKSIG + +Comparing with a P2PKH output, the witness program equivalent occupies 2 more bytes in the scriptPubKey, while moving the signature and public key from scriptSig to witness. + +=== Version 1 witness program === + +The following example is an 1-of-2 multi-signature version 1 witness program. + + witness: 0 <0x5121{33-byte-pubkey1}21{33-byte-pubkey2}52AE> + scriptSig: (empty) + scriptPubKey: <0x01{32-byte-hash-value}> + +The last item in the witness is popped off, hashed with SHA256, compared against the 32-byte-hash-value in scriptPubKey, and deserialized: + + 1 <33-byte-pubkey1> <33-byte-pubkey2> 2 CHECKMULTISIG + +The script is executed with the remaining data from witness: + + 0 1 <33-byte-pubkey1> <33-byte-pubkey2> 2 CHECKMULTISIG + +Since the actual program is larger than 40 bytes, it cannot be accommodated in a version 0 witness program. A version 1 witness program allows arbitrarily large script as the 520-byte push limit is bypassed. + +The scriptPubKey occupies 34 bytes, as opposed to 23 bytes of P2SH. The increased size improves security against possible collision attacks, as 2^80 work is not infeasible anymore (By the end of 2015, 2^84 hashes have been calculated in Bitcoin mining since the creation of Bitcoin). The spending script is same as the one for an equivalent P2SH output but is moved to witness. + +=== Witness program nested in Pay-to-Script-Hash === + +The following example is the same 1-of-2 multi-signature version 1 witness program, but nested in a P2SH output. + + witness: 0 <0x5121{33-byte-pubkey1}21{33-byte-pubkey2}52AE> + scriptSig: <0x2101{32-byte-hash-value}> + scriptPubKey: HASH160 <20-byte-hash-value> EQUAL + +The only item in scriptSig is hashed with HASH160, compared against the 20-byte-hash-value in scriptPubKey, and interpreted as a single push of: + + <0x01{32-byte-hash-value}> + +The version 1 witness program is then executed as described in the last example + +Comparing with the last example, the scriptPubKey is 11 bytes smaller (with reduced security) while witness is the same. However, it also requires 35 bytes in scriptSig, which is not prunable in transmission. Although a nested witness program is less efficient in many ways, its payment address is fully transparent and backward compatible for all Bitcoin reference client since version 0.6.0. + +=== Trust-free unconfirmed transaction dependency chain === +Segregated witness fixes the problem of transaction malleability fundamentally, which enables the building of unconfirmed transaction dependency chains in a trust-free manner. + +Two parties, Alice and Bob, may agree to send certain amount of Bitcoin to a 2-of-2 multisig output (the "funding transaction"). Without signing the funding transaction, they may create another transaction, time-locked in the future, spending the 2-of-2 multisig output to third account(s) (the "spending transaction"). Alice and Bob will sign the spending transaction and exchange the signatures. After examining the signatures, they will sign and commit the funding transaction to the blockchain. Without further action, the spending transaction will be confirmed after the lock-time and release the funding according to the original contract. It also retains the flexibility of revoking the original contract before the lock-time, by another spending transaction with shorter lock-time, but only with mutual-agreement of both parties. + +Such setups is not possible with BIP62 as the malleability fix, since the spending transaction could not be created without both parties first signing the funding transaction. If Alice reveals the funding transaction signature before Bob does, Bob is able to lock up the funding indefinitely without ever signing the spending transaction. + +Unconfirmed transaction dependency chain is a fundamental building block of more sophisticated payment networks, such as duplex micropayment channel and the Lightning Network, which have the potential to greatly improve the scalability and efficiency of the Bitcoin system. + +== Future extensions == +=== Compact fraud proof for SPV nodes === +Bitcoin right now only has two real security models. A user either runs a full-node which validates every block with all rules in the system, or a SPV (Simple Payment Verification) client which only validates the headers as a proof of publication of some transactions. The Bitcoin whitepaper suggested that SPV nodes may accept alerts from full nodes when they detect an invalid block, prompting the SPV node to download the questioned blocks and transactions for validation. This approach, however, could become a DoS attack vector as there is virtually no cost to generate a false alarm. An alarm must come with a compact, yet deterministic fraud proof. + +In the current Bitcoin protocol, it is possible to generate compact fraud proof for almost all rules except a few: + +# It is not possible to proof a miner has introduced too many Bitcoins in the coinbase transaction outputs without showing the whole block itself and all input transactions. +# It is not possible to prove the violation of any block specific constraints, such as size and sigop limits, without showing the whole block (and all input transactions in the case of sigop limit) +# It is not possible to prove the spending of a non-existing input without showing all transaction IDs in the blockchain way back to the genesis block. + +It is possible to proof the first 2 types of fraud if a block is committed to a Merkle-sum-tree of the fee, size, and sigop count of each transaction. It is also possible to proof the last type of fraud if a block is committed to a Merkle tree with the originating block height and transaction index of all inputs. These commitments could be included in the extensible witness commitment through a soft fork and will be transparent to nodes that do not understand such new rules. + +=== New script system === +Since all witness programs begin with a version byte, and programs with unknown versions are always considered as anyone-can-spend script, it is possible to introduce any new script system with a soft fork. The witness as a structure is not restricted by any existing script semantics and constraints, the 520-byte push limit in particular, and therefore allows arbitrarily large scripts and signatures. + +Examples of new script system include Schnorr signatures which reduce the size of multisig transactions dramatically, Lamport signature which is quantum computing resistance, and Merklized abstract syntax trees which allow very compact witness for conditional scripts with extreme complexity. + +The 41-byte limitation for witness programme could be easily extended through a soft fork in case a stronger hash function is needed in the future. The version byte is also expandable by introducing a secondary version byte for some specific primary version values. + +=== Per-input lock-time and relative-lock-time === +Currently there is only one nLockTime field in a transaction and all inputs must share the same value. BIP68 enables per-input relative-lock-time using the nSequence field, however, with a limited lock-time period and resolution. + +With a soft fork, it is possible to introduce a separate witness structure to allow per-input lock-time and relative-lock-time, and a new script system that could sign and manipulate the new data (like BIP65 and BIP112). + +== Backward compatibility == +As a soft fork, older software will continue to operate without modification. Non-upgraded nodes, however, will not see nor validate the witness data and will consider all witness programs as anyone-can-spend scripts (except a few edge cases in version 0 witness programs which are provably unspendable with original script semantics). Wallets should always be wary of anyone-can-spend scripts and treat them with suspicion. Non-upgraded nodes are strongly encouraged to upgrade in order to take advantage of the new features. + +=== Version 0 witness programs === +Witness programs are hashed to 256 bit "redeemscripts" which are then hashed to 160 bit P2SH. This format is fully compatible with currently existing wallets that support P2SH. Upgraded wallets will be able to send and receive to and from older wallets without any problems. + +=== Version 1 witness programs === +Witness programs are hashed to a 256 bit output. This format will not be compatible with older wallets but will require less block space and will have better security due to increased collision resistance. + +== Deployment == + +We reuse the double-threshold IsSuperMajority() switchover mechanism used in +BIP65 with the same thresholds, but for nVersion = 5. The new rules are +in effect for every block (at height H) with nVersion = 5 and at least +750 out of 1000 blocks preceding it (with heights H-1000..H-1) also +have nVersion >= 5. Furthermore, when 950 out of the 1000 blocks +preceding a block do have nVersion >= 5, nVersion < 5 blocks become +invalid, and all further blocks enforce the new rules. + +(It should be noted that BIP9 involves permanently setting a high-order bit to +1 which results in nVersion >= all prior IsSuperMajority() soft-forks and thus +no bits in nVersion are permanently lost.) + + +=== SPV Clients === + +While SPV clients are unable to fully validate blocks, +they are able to validate block headers and, thus, can check block version and proof-of-work. +SPV clients should reject nVersion < 5 blocks if 950 out of 1000 preceding blocks have +nVersion >= 5 to prevent false confirmations from the remaining 5% of +non-upgraded miners when the 95% threshold has been reached. + +== Credits == +Special thanks to Gregory Maxwell for originating many of the ideas in this BIP and Luke-Jr for figuring out how to deploy this as a soft fork. + +== Reference Implementation == +https://github.com/sipa/bitcoin/commits/segwit + +== Copyright == +This document is placed in the public domain. From 0112d56051d3406ba035a75a5033fe5de52a6c86 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Thu, 24 Dec 2015 17:23:02 -0500 Subject: [PATCH 02/11] Embedded diagram --- bip-codeshark-segwit-peer-services.mediawiki | 25 +++++++++--------- .../witnesstx.png | Bin 0 -> 18923 bytes 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 bip-codeshark-segwit-peer-services/witnesstx.png 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 0000000000000000000000000000000000000000..5fd8afcb01ce0cf08b7de1003c8be0539f226ba6 GIT binary patch literal 18923 zcmeHv2~^T)+c(uXPRry>n^`F{m8rQfWo53kn|o?$xK@hhxRCpTKuyzPSyV2hrc|bm zxu9SYE>P2AipnIpAR^_O0umyqAn^U6nR#ZObKdWLzwbNmIqx~&aE_%NxX zegCdM8OPimzh1Us83+XW+Ue*aFA!+49QfJt)tA6Kh5UCbfPWUndpRBeRd;Th0Dk!* ze81a%5U3WreBrbf@cYtpM`7_G(5eLW&!WLFa0&?Ibl&OE{^Kb@0uHLi432`NDQl0O zNzd?{*%183bNk@^`$sZ2>YPwMI5G)x)^fIYTC;ZVq{Lt*cW~p^aXF8+TF?2cm;C&d z;n_9u#bwoyO`g`&QEHb+V>zE1p*mo6LmnKOJ34Np!>(#96+Eo z&Ma-v`2!}v!jBpMZLrUj31%8U`30Gi#1_1-XOm)yIOT zm0Jub73spdGHR^;c%OR_~^5=_{?9` zLLSnscqe_TpJtflTg%{v^NGcLrfnNFK@Se@DF|5u z=*hGdy~dlyY`%Wv_Ib(J`b%n!58)6!wUq&}t6{qWrwTwdF&g0q*3#S7THQX(9HlM= z@s6;{lCx10JKG#8ty+u$qm(5N-GKTI99nl{^CDiyj%8}|WLR)3LtvDlZN#$;16GSp zaWuj&ZO_e7&sa)Ftp@enAbJRm)Jeom&yzQ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bgh3VlY3qfjFmGGh1gBdhy(T3ho_B0^Eue54> zGrO)GSh%gwZy#i&&1d_$iKOZ#N2g4k#R9r*7^`~j)y~qjEuneSeMLpf#7V7+RX^Tw z`1B|m+iP5+*dH^nj#l9e;a<*8+M&HU6wPOP!DZ`$xhuGbHQ+{H^ulaoXI2Ql3Y`xbU8D#)$Jtr z=1mws7LKhIe8NxUy=s?}<} zb?^sYO6g$<_ZEPiz^m#>>cvGvA{XKc;PenV_4u*)uB0+~KRBpMToN(N%NmPNRUAE; zpcK^gB7wFggYg;2-slKQZHx)yE;+aRkHOK>b8>dfRMo8R|+c&@{{sb9++UNqDY zC<3}bIqr?wNuCBFdbbm7yNU)ax&`ts?ZSjc#Ra1rPSVmKKytzfX_l1yDU;yuN0`GE z0?#o?pQiBV_Ph#-<9(Zrx=&Cm-enO_YJ+uA2e!bA7H=?&>mjz#dScUAVzZEbmDX>$ z%fcFG>a&*dQ{K9<3;fC1yX=$ek+#jAX|Hy-bOmZRbz?SH4&1zqPZ;>x4p8 a_XyRdy1QZ%@C8jEr^D`tst=s{>3;#p)Md^9 literal 0 HcmV?d00001 From 5036ebe02b4c2090386f8c1dc7ebee6d65a26c48 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Thu, 24 Dec 2015 17:37:28 -0500 Subject: [PATCH 03/11] Removed consensus layer stuff and added new section headers. --- bip-codeshark-segwit-peer-services.mediawiki | 219 +------------------ 1 file changed, 5 insertions(+), 214 deletions(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index c81e1dbb..35bd0598 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -15,6 +15,8 @@ This BIP defines new messages and serialization formats for propagation of trans ==Specification== +=== Serializations === + A new serialization format for tx messages is added to the peer-to-peer protocol. The serialization has the following structure: @@ -113,223 +115,12 @@ have empty ones. serialization. A new CTransaction::GetWitnessHash is added which is computed from the witness-serialization (this means that transactions with an empty witness have witness hash equal to normal hash). - -=== Commitment structure === +== Synchronization == -!!!DRAFT ONLY!!! +=== Initial Blockchain Download === -A new block rule is added which requires a commitment to the witness hashes in the coinbase (or an OP_RETURN output of a specific transaction, or somewhere else) - -(Hardfork after x year to move the commitment to block header?) - -Witness hash is the double SHA256 of a transaction including witnesses: http://blockhawk.net/diagrams/witnesstx.png. For the coinbase transaction, its witness hash is assumed to be 0x0000....0000. - -A witness root hash is calculated with all those witness hashes as leaves, in a way similar to the hashMerkleRoot in the block header. - -No witness data is allowed in blocks that don't commit to witness data, as this would otherwise leave room from spam. - -==== Proposal 1: balance tree (the current implementation) ==== -The commitment is a push of exactly 41 bytes: -*The first 4 bytes are commitment header: 0xaa21a9ed -*The next 4 bytes describe a nonce -*The next 1 byte is the "levels bytes", describes the number of levels in a Merkle tree (0 to 32) -*The next 32 bytes is a commitment root hash (not the witness root hash) - -Locator of the witness root hash is defined as: - -
SHA256('WitnessV1\x00\x00\x00\x00\x00\x00\x00' || nonce)
- -The first levels bits of locator, interpreted in little endian, are assumed to be the position in the leaves of the Merkle tree where the witness root hash goes. - -The coinbase's input's witness must consist of a single byte array of 32 * levels bytes, and are assumed to be the Merkle path to connect the witness root hash to the commitment root hash. - -====Proposal 2: imbalance tree==== -The commitment is a push of exactly 40 bytes: -*The first 4 bytes are commitment header: 0xaa21a9ed -*The next 4 bytes describe a nonce -*The next 32 bytes is a commitment root hash (not the witness root hash) - -Locator of the witness root hash is defined as: - -
SHA256('WitnessV1\x00\x00\x00\x00\x00\x00\x00' || nonce)
- -The first levels bits of locator, interpreted in little endian, are assumed to be the position in the leaves of the Merkle tree where the witness root hash goes. - -The coinbase's input's witness must consist of a single byte array, which the size must be a multiple of 32 bytes but not bigger than 32*32 bytes. These are assumed to be the Merkle path to connect the witness root hash to the commitment root hash. Depth of the commitment is determined by the length of the path. If the depth of the tree is 0, the path should be represented by 0x00, and the witness root hash will be same as the commitment root hash. - -=== Block size limit === -Blocks are currently limited to 1 MB total size. We change this restriction as follows: - -We define a base block size sb consisting of the existing header and transactions, a witness size sw consisting of only the size of the witness data, and a virtual block size sv = sb + sw/4. - -The new rule is sv <= 1 MB. - -=== Witness program === - -* A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a single push of 2 to 41 bytes gets a new special meaning. The byte vector pushed by it is called the "witness program". -** In case the scriptPubKey pushes a witness program directly, the scriptSig must be exactly empty. -** In case the redeemScript pushes a witness program, the scriptSig must be exactly the single push of the redeemScript. - -* The first byte of a witness program is the "version byte", an unsigned integer. -** If the version byte is 0, the rest of the witness program is the actual script. -*** The script is executed after normal script evaluation but with data from the witness rather than the scriptSig. -*** The program must not fail, and result in exactly a single TRUE on the stack. -** If the version byte is 1, the rest of the witness program must be 32 bytes, as a SHA256 hash of the actual script. -*** The witness must consist of an input stack to feed to the program, followed by the serialized program. -*** The serialized program is popped off the initial witness stack. Hash of the serialized program must match the hash pushed in the witness program. -*** The serialized program is deserialized, and executed after normal script evaluation with the remaining witness stack. -*** The script must not fail, and result in exactly a single TRUE on the stack. -** If the witness version byte is 2 or above, no further interpretation of the witness program or witness happens. - -=== Other consensus critical constraints === - -== Block size analysis == -WORK IN PROGRESS - -Definitions: -
- Core block size (CBS): The block size as seen by a non-upgrading full node
- Witness size (WS): The total size of witness data in a block
- Total block size (TBS): CBS + WS
- Witness discount (WD): A discount factor for witness data in VBS calculation (1 = no discount)
- Virtual block size (VBS): CBS + (WS * WD)
- Witness adoption (WA): Proportion (in size) of new format transactions among all transactions
- Prunable ratio (PR): Proportion of signature data size in a transaction
-
- -With some transformation it could be shown that: -
- TBS = CBS / (1 - WA * PR)
-     = VBS / (1 - WA * PR * (1 - WD))
-
- -In order to keep the proposal as a soft fork, the CBS must not have a upper limit higher than 1MB. - -The PR heavily depends on the transaction script type and input-output ratio. For example, the PR of 1-in 2-out P2PKH and 1-in 1-out 2-of-2 multisig P2SH are about 47% and 72% respectively. According to the data presented by Pieter Wuille on 7 December 2015, the current average PR on the blockchain is about 60%. - - - -== Examples == - -=== Version 0 witness program === - -The following example is a version 0 witness program, equivalent to the existing Pay-to-Pubkey-Hash (P2PKH) output. - - witness: - scriptSig: (empty) - scriptPubKey: <0x0076A914{20-byte-hash-value}88AC> - -The version byte 0x00 is removed. The rest of the witness program is deserialized and becomes: - - DUP HASH160 <20byte-hash-value> EQUALVERIFY CHECKSIG - -The script is executed with the data from witness - - DUP HASH160 <20byte-hash-value> EQUALVERIFY CHECKSIG - -Comparing with a P2PKH output, the witness program equivalent occupies 2 more bytes in the scriptPubKey, while moving the signature and public key from scriptSig to witness. - -=== Version 1 witness program === - -The following example is an 1-of-2 multi-signature version 1 witness program. - - witness: 0 <0x5121{33-byte-pubkey1}21{33-byte-pubkey2}52AE> - scriptSig: (empty) - scriptPubKey: <0x01{32-byte-hash-value}> - -The last item in the witness is popped off, hashed with SHA256, compared against the 32-byte-hash-value in scriptPubKey, and deserialized: - - 1 <33-byte-pubkey1> <33-byte-pubkey2> 2 CHECKMULTISIG - -The script is executed with the remaining data from witness: - - 0 1 <33-byte-pubkey1> <33-byte-pubkey2> 2 CHECKMULTISIG - -Since the actual program is larger than 40 bytes, it cannot be accommodated in a version 0 witness program. A version 1 witness program allows arbitrarily large script as the 520-byte push limit is bypassed. - -The scriptPubKey occupies 34 bytes, as opposed to 23 bytes of P2SH. The increased size improves security against possible collision attacks, as 2^80 work is not infeasible anymore (By the end of 2015, 2^84 hashes have been calculated in Bitcoin mining since the creation of Bitcoin). The spending script is same as the one for an equivalent P2SH output but is moved to witness. - -=== Witness program nested in Pay-to-Script-Hash === - -The following example is the same 1-of-2 multi-signature version 1 witness program, but nested in a P2SH output. - - witness: 0 <0x5121{33-byte-pubkey1}21{33-byte-pubkey2}52AE> - scriptSig: <0x2101{32-byte-hash-value}> - scriptPubKey: HASH160 <20-byte-hash-value> EQUAL - -The only item in scriptSig is hashed with HASH160, compared against the 20-byte-hash-value in scriptPubKey, and interpreted as a single push of: - - <0x01{32-byte-hash-value}> - -The version 1 witness program is then executed as described in the last example - -Comparing with the last example, the scriptPubKey is 11 bytes smaller (with reduced security) while witness is the same. However, it also requires 35 bytes in scriptSig, which is not prunable in transmission. Although a nested witness program is less efficient in many ways, its payment address is fully transparent and backward compatible for all Bitcoin reference client since version 0.6.0. - -=== Trust-free unconfirmed transaction dependency chain === -Segregated witness fixes the problem of transaction malleability fundamentally, which enables the building of unconfirmed transaction dependency chains in a trust-free manner. - -Two parties, Alice and Bob, may agree to send certain amount of Bitcoin to a 2-of-2 multisig output (the "funding transaction"). Without signing the funding transaction, they may create another transaction, time-locked in the future, spending the 2-of-2 multisig output to third account(s) (the "spending transaction"). Alice and Bob will sign the spending transaction and exchange the signatures. After examining the signatures, they will sign and commit the funding transaction to the blockchain. Without further action, the spending transaction will be confirmed after the lock-time and release the funding according to the original contract. It also retains the flexibility of revoking the original contract before the lock-time, by another spending transaction with shorter lock-time, but only with mutual-agreement of both parties. - -Such setups is not possible with BIP62 as the malleability fix, since the spending transaction could not be created without both parties first signing the funding transaction. If Alice reveals the funding transaction signature before Bob does, Bob is able to lock up the funding indefinitely without ever signing the spending transaction. - -Unconfirmed transaction dependency chain is a fundamental building block of more sophisticated payment networks, such as duplex micropayment channel and the Lightning Network, which have the potential to greatly improve the scalability and efficiency of the Bitcoin system. - -== Future extensions == -=== Compact fraud proof for SPV nodes === -Bitcoin right now only has two real security models. A user either runs a full-node which validates every block with all rules in the system, or a SPV (Simple Payment Verification) client which only validates the headers as a proof of publication of some transactions. The Bitcoin whitepaper suggested that SPV nodes may accept alerts from full nodes when they detect an invalid block, prompting the SPV node to download the questioned blocks and transactions for validation. This approach, however, could become a DoS attack vector as there is virtually no cost to generate a false alarm. An alarm must come with a compact, yet deterministic fraud proof. - -In the current Bitcoin protocol, it is possible to generate compact fraud proof for almost all rules except a few: - -# It is not possible to proof a miner has introduced too many Bitcoins in the coinbase transaction outputs without showing the whole block itself and all input transactions. -# It is not possible to prove the violation of any block specific constraints, such as size and sigop limits, without showing the whole block (and all input transactions in the case of sigop limit) -# It is not possible to prove the spending of a non-existing input without showing all transaction IDs in the blockchain way back to the genesis block. - -It is possible to proof the first 2 types of fraud if a block is committed to a Merkle-sum-tree of the fee, size, and sigop count of each transaction. It is also possible to proof the last type of fraud if a block is committed to a Merkle tree with the originating block height and transaction index of all inputs. These commitments could be included in the extensible witness commitment through a soft fork and will be transparent to nodes that do not understand such new rules. - -=== New script system === -Since all witness programs begin with a version byte, and programs with unknown versions are always considered as anyone-can-spend script, it is possible to introduce any new script system with a soft fork. The witness as a structure is not restricted by any existing script semantics and constraints, the 520-byte push limit in particular, and therefore allows arbitrarily large scripts and signatures. - -Examples of new script system include Schnorr signatures which reduce the size of multisig transactions dramatically, Lamport signature which is quantum computing resistance, and Merklized abstract syntax trees which allow very compact witness for conditional scripts with extreme complexity. - -The 41-byte limitation for witness programme could be easily extended through a soft fork in case a stronger hash function is needed in the future. The version byte is also expandable by introducing a secondary version byte for some specific primary version values. - -=== Per-input lock-time and relative-lock-time === -Currently there is only one nLockTime field in a transaction and all inputs must share the same value. BIP68 enables per-input relative-lock-time using the nSequence field, however, with a limited lock-time period and resolution. - -With a soft fork, it is possible to introduce a separate witness structure to allow per-input lock-time and relative-lock-time, and a new script system that could sign and manipulate the new data (like BIP65 and BIP112). - -== Backward compatibility == -As a soft fork, older software will continue to operate without modification. Non-upgraded nodes, however, will not see nor validate the witness data and will consider all witness programs as anyone-can-spend scripts (except a few edge cases in version 0 witness programs which are provably unspendable with original script semantics). Wallets should always be wary of anyone-can-spend scripts and treat them with suspicion. Non-upgraded nodes are strongly encouraged to upgrade in order to take advantage of the new features. - -=== Version 0 witness programs === -Witness programs are hashed to 256 bit "redeemscripts" which are then hashed to 160 bit P2SH. This format is fully compatible with currently existing wallets that support P2SH. Upgraded wallets will be able to send and receive to and from older wallets without any problems. - -=== Version 1 witness programs === -Witness programs are hashed to a 256 bit output. This format will not be compatible with older wallets but will require less block space and will have better security due to increased collision resistance. - -== Deployment == - -We reuse the double-threshold IsSuperMajority() switchover mechanism used in -BIP65 with the same thresholds, but for nVersion = 5. The new rules are -in effect for every block (at height H) with nVersion = 5 and at least -750 out of 1000 blocks preceding it (with heights H-1000..H-1) also -have nVersion >= 5. Furthermore, when 950 out of the 1000 blocks -preceding a block do have nVersion >= 5, nVersion < 5 blocks become -invalid, and all further blocks enforce the new rules. - -(It should be noted that BIP9 involves permanently setting a high-order bit to -1 which results in nVersion >= all prior IsSuperMajority() soft-forks and thus -no bits in nVersion are permanently lost.) - - -=== SPV Clients === - -While SPV clients are unable to fully validate blocks, -they are able to validate block headers and, thus, can check block version and proof-of-work. -SPV clients should reject nVersion < 5 blocks if 950 out of 1000 preceding blocks have -nVersion >= 5 to prevent false confirmations from the remaining 5% of -non-upgraded miners when the 95% threshold has been reached. +=== Message Propagation === == Credits == Special thanks to Gregory Maxwell for originating many of the ideas in this BIP and Luke-Jr for figuring out how to deploy this as a soft fork. From 0d887af4035dc8f5258ad3c54f5a42d2973f6b1d Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Fri, 25 Dec 2015 19:03:02 -0500 Subject: [PATCH 04/11] Separate authors into two lines. --- bip-codeshark-segwit-peer-services.mediawiki | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index 35bd0598..121cd5a1 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -1,7 +1,8 @@
   BIP: x
   Title: Segregated Witness (Peer Services)
-  Authors: Eric Lombrozo , Pieter Wuille 
+  Author: Eric Lombrozo 
+          Pieter Wuille 
   Status: Draft
   Type: Standards Track
   Created: 2015-12

From 84dc2f7ddcf0b08adec056532fd9021ee461d1d5 Mon Sep 17 00:00:00 2001
From: Eric Lombrozo 
Date: Fri, 25 Dec 2015 18:57:27 -0500
Subject: [PATCH 05/11] New sections

---
 bip-codeshark-segwit-peer-services.mediawiki | 30 ++++++++------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki
index 121cd5a1..37c5d17d 100644
--- a/bip-codeshark-segwit-peer-services.mediawiki
+++ b/bip-codeshark-segwit-peer-services.mediawiki
@@ -16,8 +16,7 @@ This BIP defines new messages and serialization formats for propagation of trans
 
 ==Specification==
 
-=== Serializations ===
-
+=== Serialization ===
 A new serialization format for tx messages is added to the peer-to-peer protocol.
 
 The serialization has the following structure:
@@ -63,7 +62,7 @@ The serialization has the following structure:
 | txouts[]
 | A list of one or more transaction outputs
 |-
-| 
+| 1+
 | txin_witness
 | txin_witness
 | Transaction input witness
@@ -85,10 +84,7 @@ Witness objects can potentially be extended to contain other kinds of witness da
 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.
-- Rationale for not having an independent CWitnessTransaction with
+- Rationale for not having an independent message type with
 its own serialization: this would require separate "tx" and "block"
 messages, and all RPC calls operating on raw transactions would need
 to be duplicated, or need inefficinent or nondeterministic guesswork
@@ -100,29 +96,27 @@ used in some tests) to be interpreted as new serialized data.
 easily add more extra non-committed data to transactions (like txouts
 being spent, ...). It can be interpreted as a bitvector.
 
-* A new message 'havewitness' is sent after receiving 'verack' to
+=== Handshake ===
+A new message 'havewitness' is sent after receiving 'verack' to
 indicate that a node can provide witness if requested (similar to
-'sendheaders')
+'sendheaders') (Note: it might be better to signal this with a services bit in the version message)
 
-* New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only
+=== Relay ===
+New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only
 for use in getdata. Inv itself still use just MSG_TX and MSG_BLOCK,
 similar to MSG_FILTERED_BLOCK.
+
 - Rationale for not advertizing witnessness in invs: we don't always
 use invs anymore (with 'sendheaders' BIP 130), plus it's not useful:
 implicitly, every transaction and block have a witness, old ones just
 have empty ones.
 
-* Transactions' GetHash is always computed on the old non-witness
-serialization. A new CTransaction::GetWitnessHash is added which is
+=== Hashes ===
+Transaction hashes used in the transaction merkle tree and txin outpoints is always computed on the old non-witness
+serialization. A new hash including the witness data is added that is
 computed from the witness-serialization (this means that transactions
 with an empty witness have witness hash equal to normal hash).
 
-== Synchronization ==
-
-=== Initial Blockchain Download ===
-
-=== Message Propagation ===
-
 == Credits ==
 Special thanks to Gregory Maxwell for originating many of the ideas in this BIP and Luke-Jr for figuring out how to deploy this as a soft fork.
 

From 0ea5ba232dd33836d9ce0a4b24690dd8a8c0f193 Mon Sep 17 00:00:00 2001
From: Eric Lombrozo 
Date: Fri, 25 Dec 2015 19:14:36 -0500
Subject: [PATCH 06/11] Added motivation section text.

---
 bip-codeshark-segwit-peer-services.mediawiki | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki
index 37c5d17d..7e94b737 100644
--- a/bip-codeshark-segwit-peer-services.mediawiki
+++ b/bip-codeshark-segwit-peer-services.mediawiki
@@ -9,10 +9,10 @@
 
==Abstract== - This BIP defines new messages and serialization formats for propagation of transactions and blocks committing to segregated witness structures. ==Motivation== +In addition to defining witness structures and requiring commitments in future blocks (BIPxxxx - Consensus segwit BIP), new mechanisms must be defined to allow peers to advertise support for segregated witness and to relay the witness structures and request them from other peers without breaking compatibility with older nodes. ==Specification== From 0ab3b3eb0c50ea24c9043219d7f968825dc68221 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Fri, 25 Dec 2015 19:17:00 -0500 Subject: [PATCH 07/11] Moved diagrams to hashes section. --- bip-codeshark-segwit-peer-services.mediawiki | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index 7e94b737..c5b205ef 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -73,8 +73,6 @@ The serialization has the following structure: | The block number or timestamp until which the transaction is locked |} - - 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. @@ -112,10 +110,15 @@ implicitly, every transaction and block have a witness, old ones just have empty ones. === Hashes === -Transaction hashes used in the transaction merkle tree and txin outpoints is always computed on the old non-witness -serialization. A new hash including the witness data is added that is -computed from the witness-serialization (this means that transactions -with an empty witness have witness hash equal to normal hash). +Transaction hashes used in the transaction merkle tree and txin outpoints are always computed using the old non-witness +serialization. + +Support for a new hash including the witness data is added that is +computed from the new witness serialization. (Note that transactions +with an empty witness always use the old serialization, +and therefore, they have witness hash equal to normal hash.) + + == Credits == Special thanks to Gregory Maxwell for originating many of the ideas in this BIP and Luke-Jr for figuring out how to deploy this as a soft fork. From 1f538fd4589b18ddede831e0cbfb0401f5ec8472 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Fri, 25 Dec 2015 19:41:39 -0500 Subject: [PATCH 08/11] Bulletted rationales and other minor changes. --- bip-codeshark-segwit-peer-services.mediawiki | 30 ++++++-------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index c5b205ef..6e0bc6e7 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -63,9 +63,9 @@ The serialization has the following structure: | A list of one or more transaction outputs |- | 1+ -| txin_witness -| txin_witness -| Transaction input witness +| txin_witnesses +| txin_witnesses[] +| A list of one or more transaction input witnesses (note: the count is just txin_count) |- | 4 | lock_time @@ -77,22 +77,13 @@ Parsers supporting this BIP will be able to distinguish between the old serializ 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. +Witness objects can be extended to contain other kinds of witness data not yet specified. This BIP is agnostic to the witness data structure, defined in BIPxxxx (Consensus Segwit BIP), and treats it as an arbitrary byte array. -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). +* '''Rationale for not having an independent message type with its own serialization''': this would require separate "tx" and "block" messages, and all RPC calls operating on raw transactions would need to be duplicated, or need inefficinent or nondeterministic guesswork to know which type is to be used. -- Rationale for not having an independent message type with -its own serialization: this would require separate "tx" and "block" -messages, and all RPC calls operating on raw transactions would need -to be duplicated, or need inefficinent or nondeterministic guesswork -to know which type is to be used. -- Rationale for not using just a single 0x00 byte as marker: that -would lead to empty transactions (no inputs, no outputs, which are -used in some tests) to be interpreted as new serialized data. -- Rationale for the 0x01 flag byte in between: this will allow us to -easily add more extra non-committed data to transactions (like txouts -being spent, ...). It can be interpreted as a bitvector. +* '''Rationale for not using just a single 0x00 byte as marker''': that would lead to empty transactions (no inputs, no outputs, which are used in some tests) to be interpreted as new serialized data. + +* '''Rationale for the 0x01 flag byte in between''': this will allow us to easily add more extra non-committed data to transactions (like txouts being spent, ...). It can be interpreted as a bitvector. === Handshake === A new message 'havewitness' is sent after receiving 'verack' to @@ -104,10 +95,7 @@ New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only for use in getdata. Inv itself still use just MSG_TX and MSG_BLOCK, similar to MSG_FILTERED_BLOCK. -- Rationale for not advertizing witnessness in invs: we don't always -use invs anymore (with 'sendheaders' BIP 130), plus it's not useful: -implicitly, every transaction and block have a witness, old ones just -have empty ones. +* '''Rationale for not advertizing witnessness in invs''': we don't always use invs anymore (with 'sendheaders' BIP 130), plus it's not useful: implicitly, every transaction and block have a witness, old ones just have empty ones. === Hashes === Transaction hashes used in the transaction merkle tree and txin outpoints are always computed using the old non-witness From 35990e2faa69c326807418a6405a25139e92db6f Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Fri, 25 Dec 2015 19:56:11 -0500 Subject: [PATCH 09/11] Use abstract witness structure --- bip-codeshark-segwit-peer-services.mediawiki | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index 6e0bc6e7..7501d2b8 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -63,9 +63,9 @@ The serialization has the following structure: | A list of one or more transaction outputs |- | 1+ -| txin_witnesses -| txin_witnesses[] -| A list of one or more transaction input witnesses (note: the count is just txin_count) +| witness +| witness +| The witness structure as a serialized byte array |- | 4 | lock_time @@ -73,9 +73,9 @@ The serialization has the following structure: | The block number or timestamp until which the transaction is locked |} -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. +Parsers supporting this BIP will be able to distinguish between the old serialization format (without the witness) 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. +If the witness is empty, the old serialization format should be used. Witness objects can be extended to contain other kinds of witness data not yet specified. This BIP is agnostic to the witness data structure, defined in BIPxxxx (Consensus Segwit BIP), and treats it as an arbitrary byte array. From d0ad38fb692ac919bd116a69f5f60e0c856b9148 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Sat, 26 Dec 2015 16:41:57 -0500 Subject: [PATCH 10/11] Added to relay section. --- bip-codeshark-segwit-peer-services.mediawiki | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-codeshark-segwit-peer-services.mediawiki index 7501d2b8..78412c1d 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-codeshark-segwit-peer-services.mediawiki @@ -90,13 +90,6 @@ A new message 'havewitness' is sent after receiving 'verack' to indicate that a node can provide witness if requested (similar to 'sendheaders') (Note: it might be better to signal this with a services bit in the version message) -=== Relay === -New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only -for use in getdata. Inv itself still use just MSG_TX and MSG_BLOCK, -similar to MSG_FILTERED_BLOCK. - -* '''Rationale for not advertizing witnessness in invs''': we don't always use invs anymore (with 'sendheaders' BIP 130), plus it's not useful: implicitly, every transaction and block have a witness, old ones just have empty ones. - === Hashes === Transaction hashes used in the transaction merkle tree and txin outpoints are always computed using the old non-witness serialization. @@ -108,6 +101,17 @@ and therefore, they have witness hash equal to normal hash.) +=== Relay === +New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only +for use in getdata. Inventory messages themselves still use just MSG_TX and MSG_BLOCK, +similar to MSG_FILTERED_BLOCK. + +* '''Rationale for not advertizing witnessness in invs''': we don't always use invs anymore (with 'sendheaders' BIP 130), plus it's not useful: implicitly, every transaction and block have a witness, old ones just have empty ones. + +MSG_WITNESS_TX getdata requests should use the non-witness serialized hash. The peer shall respond with a tx message, and if the witness structure is nonempty, the witness serialization shall be used. + +MSG_WITNESS_BLOCK requests will return a block message with transactions that have a witness using witness serialization. + == Credits == Special thanks to Gregory Maxwell for originating many of the ideas in this BIP and Luke-Jr for figuring out how to deploy this as a soft fork. From 8084782fa5d3143555db1e8ac13eda5a4ae82c52 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 8 Jan 2016 17:59:36 +0000 Subject: [PATCH 11/11] Assign BIP 144 --- README.mediawiki | 6 ++++++ ...it-peer-services.mediawiki => bip-0144.mediawiki | 4 ++-- .../witnesstx.png | Bin 3 files changed, 8 insertions(+), 2 deletions(-) rename bip-codeshark-segwit-peer-services.mediawiki => bip-0144.mediawiki (98%) rename {bip-codeshark-segwit-peer-services => bip-0144}/witnesstx.png (100%) diff --git a/README.mediawiki b/README.mediawiki index b45c17a0..ce44289c 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -379,6 +379,12 @@ Those proposing changes should consider that ultimately consent may rest with th | Suhas Daftuar | Standard | Draft +|- +| [[bip-0144.mediawiki|144]] +| Segregated Witness (Peer Services) +| Eric Lombrozo, Pieter Wuille +| Standard +| Draft |} diff --git a/bip-codeshark-segwit-peer-services.mediawiki b/bip-0144.mediawiki similarity index 98% rename from bip-codeshark-segwit-peer-services.mediawiki rename to bip-0144.mediawiki index 78412c1d..ed8cf2be 100644 --- a/bip-codeshark-segwit-peer-services.mediawiki +++ b/bip-0144.mediawiki @@ -1,5 +1,5 @@
-  BIP: x
+  BIP: 144
   Title: Segregated Witness (Peer Services)
   Author: Eric Lombrozo 
           Pieter Wuille 
@@ -99,7 +99,7 @@ computed from the new witness serialization. (Note that transactions
 with an empty witness always use the old serialization,
 and therefore, they have witness hash equal to normal hash.)
 
-
+
 
 === Relay ===
 New inv types MSG_WITNESS_TX and MSG_WITNESS_BLOCK are added, only
diff --git a/bip-codeshark-segwit-peer-services/witnesstx.png b/bip-0144/witnesstx.png
similarity index 100%
rename from bip-codeshark-segwit-peer-services/witnesstx.png
rename to bip-0144/witnesstx.png