From d84186c01caa6728aff157b596908e8c5fdd2ad0 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Tue, 3 Jan 2017 17:07:37 -0600 Subject: Specify which 1 byte push op codes are valid This adds documentation to BIP141 about which 1 byte push op codes are valid for segwit. This is needed because `OP_1NEGATE` is a 1 byte push op code, but is NOT a valid 1 byte push op code for segwit. See the implementation here for why `OP_1NEGATE` is not valid: https://github.com/bitcoin/bitcoin/blob/14d01309bed59afb08651f2b701ff90371b15b20/src/script/script.cpp#L228 --- bip-0141.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0141.mediawiki b/bip-0141.mediawiki index 7cc587a..cbdf5ce 100644 --- a/bip-0141.mediawiki +++ b/bip-0141.mediawiki @@ -83,7 +83,7 @@ If all transactions in a block do not have witness data, the commitment is optio === Witness program === -A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program". +A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a valid 1-byte push opcode (OP_0,OP_1,OP_2...,OP_16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program". There are two cases in which witness validation logic are triggered. Each case determines the location of the witness version byte and program, as well as the form of the scriptSig: # Triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program. The scriptSig must be exactly empty or validation fails. (''"native witness program"'') -- cgit v1.2.3 From 608d5dc95f2ddcee32758fe73de6d68b99021e39 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Tue, 3 Jan 2017 17:46:14 -0600 Subject: Update bip-0141.mediawiki Clarifying rewording, `OP_0` is not a 1 byte push op code since it pushes the empty byte vector onto the stack. --- bip-0141.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0141.mediawiki b/bip-0141.mediawiki index cbdf5ce..eeb6eb9 100644 --- a/bip-0141.mediawiki +++ b/bip-0141.mediawiki @@ -83,7 +83,7 @@ If all transactions in a block do not have witness data, the commitment is optio === Witness program === -A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a valid 1-byte push opcode (OP_0,OP_1,OP_2...,OP_16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program". +A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a select subset of opcodes (OP_0,OP_1,OP_2,...,OP_16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program". There are two cases in which witness validation logic are triggered. Each case determines the location of the witness version byte and program, as well as the form of the scriptSig: # Triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program. The scriptSig must be exactly empty or validation fails. (''"native witness program"'') -- cgit v1.2.3