BIPs 0066 · 0146
Why must a signature have exactly one encoding?
An ECDSA signature is two numbers written as bytes. If the same numbers can be written in more than one way, anyone relaying a transaction can change its bytes, and with them its ID. BIP 66 allows one encoding; BIP 146 proposed closing the gaps that remained.
An ECDSA signature in a Bitcoin transaction is two numbers, R and S, written in DER, a standard binary encoding. When BIP 66 was written in 2015, the reference client checked signatures with OpenSSL, whose releases had until then accepted various deviations from DER as valid. The same two numbers could be written in more than one way, and which ways a node accepted depended on its OpenSSL version.123
That caused two problems. When OpenSSL tightened its parsing, some nodes rejected the chain. And anyone relaying a transaction could rewrite a signature's bytes without the private key, changing the transaction's ID. BIP 66 makes exactly one encoding valid. BIP 146 proposed closing the two gaps that strict encoding leaves open.234567
Source details
This chapter is an independent explanation, not the proposal itself. Preamble fields are shown as the pinned files record them, without author e-mail addresses. Status is the proposal’s own field. It is not an endorsement or a sign of consensus.
BIP 66: Strict DER signatures
- BIP
- 66
- Layer
- Consensus (soft fork)
- Title
- Strict DER signatures
- Authors
- Pieter Wuille
- Status
- Deployed
- Type
- Specification
- Assigned
- 2015-01-10
- License
- BSD-2-Clause
BIP 146: Dealing with signature encoding malleability
- BIP
- 146
- Layer
- Consensus (soft fork)
- Title
- Dealing with signature encoding malleability
- Authors
- Johnson Lau
Pieter Wuille - Status
- Closed
- Type
- Specification
- Assigned
- 2016-08-16
- License
- PD
Fig. A23.1 One signature, four changes
Static view: the signature as published. With JavaScript you can try four changes to its bytes.
As published: 72 bytes. R and S are the same numbers as published. Strict DER, a valid signature, and S in the lower half: accepted.
Exact values
- Signature (72 bytes, sighash byte last)
30450221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01- R
8b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be- S
40529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed- Signed digest (legacy, computed)
63cec688ee06a91e913875356dd4dea2f8e0f2a2659885372da2a37e32c7532e- txid with this signature (display order)
e8151a2af31c368a35053ddd4bdb285a8595c769a3ad83e0fa02314a602d4609
BIP 143 line 195 (input 0's scriptSig in its signed example, line 190). The four changes are computed by the model from those bytes; BIP 66's checks are lines 55–101 of its reference function. The example's keys are printed in BIP 143: test material only.
R's zero byte removed: 71 bytes. R keeps its digits but, without the zero byte, DER reads it as negative; S is unchanged. BIP 66 rejects it at line 84 (R is not negative): the script fails at once, before any ECDSA check. If nodes accepted it, the transaction's txid would change.
Exact values
- Signature (71 bytes, sighash byte last)
304402208b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01- R
8b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be- S
40529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed- Signed digest (legacy, computed)
63cec688ee06a91e913875356dd4dea2f8e0f2a2659885372da2a37e32c7532e- txid with this signature (display order)
a72986614edd902ce336403bb1a7eb69ca88fe6ad2884286367a65bbb8f700c6
BIP 143 line 195 (input 0's scriptSig in its signed example, line 190). The four changes are computed by the model from those bytes; BIP 66's checks are lines 55–101 of its reference function. The example's keys are printed in BIP 143: test material only.
Zero byte added to S: 73 bytes. R and S are the same numbers as published. BIP 66 rejects it at line 101 (S has no extra leading zero): the script fails at once, before any ECDSA check. If nodes accepted it, the transaction's txid would change.
Exact values
- Signature (73 bytes, sighash byte last)
30460221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be02210040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01- R
8b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be- S
40529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed- Signed digest (legacy, computed)
63cec688ee06a91e913875356dd4dea2f8e0f2a2659885372da2a37e32c7532e- txid with this signature (display order)
23d9be712107a56dbaa0a27fbd5cfd93a8f8a65dc39d6d5398aa333acca6360b
BIP 143 line 195 (input 0's scriptSig in its signed example, line 190). The four changes are computed by the model from those bytes; BIP 66's checks are lines 55–101 of its reference function. The example's keys are printed in BIP 143: test material only.
Length byte off by one: 72 bytes. R and S are the same numbers as published. BIP 66 rejects it at line 62 (length byte covers the rest): the script fails at once, before any ECDSA check. If nodes accepted it, the transaction's txid would change.
Exact values
- Signature (72 bytes, sighash byte last)
30460221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01- R
8b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be- S
40529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed- Signed digest (legacy, computed)
63cec688ee06a91e913875356dd4dea2f8e0f2a2659885372da2a37e32c7532e- txid with this signature (display order)
7d535014a648d6d14e21aee3fc4065e9e34b41cc4fa3fb564c5777e3bd37fae6
BIP 143 line 195 (input 0's scriptSig in its signed example, line 190). The four changes are computed by the model from those bytes; BIP 66's checks are lines 55–101 of its reference function. The example's keys are printed in BIP 143: test material only.
S replaced by its twin: 73 bytes. R is the same; S is replaced by n − S. Strict DER and still a valid ECDSA signature, but S is in the upper half, so BIP 146's proposed LOW_S rule would reject it. BIP 146 records LOW_S as relay policy, not a consensus rule. Anyone can make this change without the key, and it changes the transaction's txid.
Exact values
- Signature (73 bytes, sighash byte last)
30460221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022100bfad64e6b45c06d7e5660d4e3f5e63fa30f2b9f8c603d346d317a9c06ea74d5401- R
8b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be- S
bfad64e6b45c06d7e5660d4e3f5e63fa30f2b9f8c603d346d317a9c06ea74d54- Signed digest (legacy, computed)
63cec688ee06a91e913875356dd4dea2f8e0f2a2659885372da2a37e32c7532e- txid with this signature (display order)
d1cfba03fcf676e36932864dde6d682ba4b1ad3158473a1cfa24b2a557f451ae
BIP 143 line 195 (input 0's scriptSig in its signed example, line 190). The four changes are computed by the model from those bytes; BIP 66's checks are lines 55–101 of its reference function. The example's keys are printed in BIP 143: test material only.
One encoding
BIP 66 applies to every signature passed to OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG or OP_CHECKMULTISIGVERIFY for ECDSA verification. It must be strict DER, as a short reference function in the BIP checks. If that check fails, the whole script fails at once. A strict signature that is simply wrong behaves as it did before.1314
The format is 0x30, the length of everything after it except the sighash byte, then R and S, each as 0x02, a length and the number in big-endian bytes. A number may not start with a zero byte, except one zero when the next byte has its top bit set, or it would read as negative. The sighash byte Bitcoin appends sits outside DER. BIP 66 does not run its check on an empty signature, which stays a short, deliberately invalid one.115
Fig. A23.2 A DER signature, field by field
The rule only adds failures, so it could be deployed as a soft fork. It reused BIP 34's mechanism with block version 3. The rule was enforced in version 3 blocks once 750 of the previous 1,000 had version 3, and version 2 blocks became invalid once 950 did. The reference client had already refused to relay non-DER signatures since version 0.8.0, and any such signature could be rewritten in strict form.161718
The twin signature
Strict DER fixes the bytes, not the numbers. ECDSA has a symmetry: if (R, S) is a valid signature, so is (R, n − S), where n is the order of the curve. Anyone can compute that twin without the private key.719
BIP 146's LOW_S rule keeps only the lower half: S must lie between 1 and n / 2. Under the rule, a signature outside that range makes the script fail at once. Of S and its twin, exactly one is in that half, so for the script types in actual use a signer can always provide a compliant signature.102021
Fig. A23.3 Each S and its twin
BIP 146's NULLFAIL rule addresses the other gap. A failing signature check leaves FALSE on the stack and lets the script continue. As BIP 146 points out, the failing signature can therefore be any bytes that pass BIP 66. Under NULLFAIL, a check that returns false must have been given an empty signature (for OP_CHECKMULTISIG, every signature); otherwise the script fails.722
What the identifier hashes
A txid hashes every scriptSig, so changing a signature there changes the txid and breaks any unconfirmed transaction that spends its outputs. SegWit's txid leaves the witness out. A witness signature can still be flipped, but that changes only the wtxid.42324
Fig. A23.4 What a flipped S changes
As published: input 0 signs in its scriptSig, input 1 in its witness.
Input 0's S replaced by n − S: the txid and the wtxid both change.
Input 1's S replaced instead: only the wtxid changes.
Exact identifiers (display order)
- Published txid
e8151a2af31c368a35053ddd4bdb285a8595c769a3ad83e0fa02314a602d4609- Published wtxid
c36c38370907df2324d9ce9d149d191192f338b37665a82e78e76a12c909b762- Input 0 flipped: txid
d1cfba03fcf676e36932864dde6d682ba4b1ad3158473a1cfa24b2a557f451ae- Input 0 flipped: wtxid
15a47744bde5462976ffcfd2c422970bcebb852d2765be96f4cb19d6f5df92f1- Input 1 flipped: txid
e8151a2af31c368a35053ddd4bdb285a8595c769a3ad83e0fa02314a602d4609- Input 1 flipped: wtxid
05a2eb2eb45a327a60ce6f9cada2ec9841c537e9d47468aa3237d369c88b9678
BIP 66 is recorded as Deployed. BIP 146 is recorded as Closed, and its deployment section was left as "Details TBD". Its rules cover legacy and SegWit scripts alike. It records LOW_S and NULLFAIL as relay policy in the reference client as of 2016, so it did not make either one a consensus rule. A high-S signature is not made invalid by BIP 146. It also says users MUST pay extra attention to these rules when designing exotic scripts.6122125262728
Both BIPs were extracted from BIP 62, an earlier proposal against malleability that is now recorded as Closed.29
Evidence
Each numbered marker in the text points here, and the ↩ links lead back to the text. Quotes are verbatim
from the BIP files at commit 3a10b5b, wiki markup
included. Links open the exact lines. Labels say what kind of statement each entry is: a rule, the
author’s rationale, history, a test vector, or our own inference.
-
↩ a b c Rule The format is 0x30, a total length, then 0x02, R's length and R, 0x02, S's length and S, then the sighash byte; R and S are big-endian and must use the shortest encoding of a positive integer, with no leading zero bytes except one when the next byte has its top bit set.
Quoted source text (2)
// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] [sighash]
// * R: arbitrary-length big-endian encoded R value. It must use the shortest // possible encoding for a positive integers (which means no null bytes at // the start, except a single one when the next byte has its highest bit set).
-
↩ a b c History When BIP 66 was written, the reference implementation relied on OpenSSL to validate signatures, so OpenSSL implicitly defined block validity; OpenSSL had accepted various deviations from DER, and when that changed in versions 1.0.0p and 1.0.1k some nodes rejected the chain.
Quoted source text (2)
Bitcoin's reference implementation currently relies on OpenSSL for signature validation, which means it is implicitly defining Bitcoin's block validity rules.
Until recently, OpenSSL's releases would accept various deviations from the DER standard and accept signatures as valid. When this changed in OpenSSL 1.0.0p and 1.0.1k, it made some nodes reject the chain.
-
↩ a b History BIP 62 listed non-DER signatures as a source of malleability, because OpenSSL accepted more than strict DER serializations.
Quoted source text (1)
As OpenSSL accepts more than serializations that strictly adhere to the DER standard, this is a source of malleability.
-
↩ a b Author’s rationale Signature malleability is the ability of any relay node to transform a transaction's signatures without the private keys; for non-SegWit transactions it changes the txid and invalidates unconfirmed children, and for SegWit transactions, whose txid is not third-party malleable, it changes the wtxid and may make compact block relay less efficient.
Quoted source text (1)
Signature malleability refers to the ability of any relay node on the network to transform the signature in transactions, with no access to the relevant private keys required. For non-segregated witness transactions, signature malleability will change the <code>txid</code> and invalidate any unconfirmed child transactions. Although the <code>txid</code> of segregated witness ([https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki BIP141]) transactions is not third party malleable, this malleability vector will change the <code>wtxid</code> and may reduce the efficiency of compact block relay
-
↩ Rule BIP 66 proposes restricting signatures to strict DER encoding in the transaction validity rules.
Quoted source text (1)
This document specifies proposed changes to the Bitcoin transaction validity rules to restrict signatures to strict DER encoding.
-
↩ a b Rule BIP 146 proposes rules against signature malleability related to ECDSA encoding, applied to legacy and SegWit scripts alike.
Quoted source text (2)
This document specifies proposed changes to the Bitcoin transaction validity rules to fix signature malleability related to ECDSA signature encoding.
To fix signature encoding malleability, the following new rules are applied to pre-segregated witness and segregated witness scripts:
-
↩ a b c Author’s rationale The authors note that after BIP 66 two known sources of ECDSA signature malleability remained: negating S modulo the curve order leaves a signature valid, and a failing signature can be any BIP 66-compliant value, since the failure only pushes FALSE and the script continues.
Quoted source text (1)
Since the enforcement of Strict DER signatures ([https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki BIP66]), there are 2 remaining known sources of malleability in ECDSA signatures: # '''Inherent ECDSA signature malleability''': ECDSA signatures are inherently malleable as taking the negative of the number S inside (modulo the curve order) does not invalidate it. # '''Malleability of failing signature''': If a signature failed to validate in <code>OP_CHECKSIG</code> or <code>OP_CHECKMULTISIG</code>, a <code>FALSE</code> would be returned to the stack and the script evaluation would continue. The failing signature may take any value, as long as it follows all the rules described in BIP66.
-
↩ Rule BIP 66's reference function checks, in order: 9 to 73 bytes, a 0x30 start, a total length covering the signature, the R and S lengths, each element marked 0x02, non-empty, not negative, and without extra leading zeros.
BIP 66 L54–56 BIP 66 L61–62 BIP 66 L83–84 BIP 66 L99–101
Quoted source text (4)
// Minimum and maximum size constraints. if (sig.size() < 9) return false; if (sig.size() > 73) return false;
// Make sure the length covers the entire signature. if (sig[1] != sig.size() - 3) return false;
// Negative numbers are not allowed for R. if (sig[4] & 0x80) return false;
// Null bytes at the start of S are not allowed, unless S would otherwise be // interpreted as a negative number. if (lenS > 1 && (sig[lenR + 6] == 0x00) && !(sig[lenR + 7] & 0x80)) return false;
-
↩ Test vector In the model, three changes to input 0's signature write the same digits of R and S in different bytes and fail BIP 66: without its zero pad R's bytes read as a negative number (line 84), an extra zero in front of S fails line 101, and a total length one too large fails line 62.
BIP 66 L83–84 BIP 66 L99–101 BIP 66 L61–62
Quoted source text (3)
// Negative numbers are not allowed for R. if (sig[4] & 0x80) return false;
// Null bytes at the start of S are not allowed
// Make sure the length covers the entire signature.
-
↩ a b c Test vector In the model, replacing S by n − S gives a strict DER signature that still verifies (ECDSA with low-S checking off) but fails LOW_S; for input 0 it is 73 bytes, BIP 66's maximum, because n − S needs a zero pad. Exactly one of S and n − S is in the lower half.
Quoted source text (2)
A high S value in signature could be trivially replaced by
if (sig.size() > 73) return false;
-
↩ a b Test vector In the model, BIP 143's signed native P2WPKH example carries two ECDSA signatures: input 0's, spending a P2PK output, in its scriptSig (72 bytes, R padded to 33 bytes), and input 1's, spending a P2WPKH output, in its witness (71 bytes). Both are strict DER with low S and verify, input 1's against the published digest and input 0's against the legacy digest the model computes.
BIP 143 L151–152 BIP 143 L155–156 BIP 143 L187–188 BIP 143 L190
Quoted source text (4)
The first input comes from an ordinary P2PK: scriptPubKey : 2103c9f4836b9a4f77fc0d81f7bcb01b7f1b35916864b9476c241ce9fc198bd25432ac value: 6.25
The second input comes from a P2WPKH witness program:
sigHash: c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670
The serialized signed transaction is:
-
↩ a b Editorial inference By these texts, BIP 146 did not make LOW_S or NULLFAIL consensus rules: the BIP is Closed, its deployment was never specified, and it records both as relay policy of the reference client. A high-S signature is not made invalid by BIP 146.
BIP 146 L7 BIP 146 L98 BIP 146 L107 BIP 146 L109
Quoted source text (4)
Status: Closed
Details TBD.
the LOW_S rule has been enforced as relay policy by the reference client since v0.11.1.
The NULLFAIL rule has been enforced as relay policy by the reference client since v0.13.1.
-
↩ Rule Every signature passed to OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG or OP_CHECKMULTISIGVERIFY for ECDSA verification must be strict DER; a signature that fails the IsValidSignatureEncoding check makes the whole script false immediately, while a valid DER signature that fails ECDSA verification behaves as before.
Quoted source text (2)
Every signature passed to OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG, or OP_CHECKMULTISIGVERIFY, to which ECDSA verification is applied, must be encoded using strict DER encoding (see further).
For each such verification, if the signature does not pass the <code>IsValidSignatureEncoding</code> check below, the entire script evaluates to false immediately. If the signature is valid DER, but does not pass ECDSA verification, opcode execution continues as it used to
-
↩ Author’s rationale The author's aim: restrict valid signatures to exactly what DER mandates, so the consensus rules no longer depend on OpenSSL's signature parsing.
Quoted source text (1)
This document proposes to restrict valid signatures to exactly what is mandated by DER, to make the consensus rules not depend on OpenSSL's signature parsing.
-
↩ Rule The check runs on the signature bytes including Bitcoin's 1-byte sighash flag, which is outside DER and unaffected; it is not called for an empty signature, kept as a short encoding of a deliberately invalid signature.
Quoted source text (1)
Note that this function tests a signature byte vector which includes the 1-byte sighash flag that Bitcoin adds, even though that flag falls outside of the DER specification, and is unaffected by this proposal. The function is also not called for cases where the length of sig is 0, in order to provide a simple, short and efficiently-verifiable encoding for deliberately invalid signatures.
-
↩ Author’s rationale BIP 66's examples show the change only adds failures, as a soft fork requires.
Quoted source text (1)
Note that the examples above show that only additional failures are required by this change, as required for a soft forking change.
-
↩ History BIP 66 reused BIP 34's double-threshold switchover for block version 3: the rules apply to version 3 blocks once 750 of the previous 1000 blocks are version 3, and once 950 are, version 2 blocks become invalid.
Quoted source text (1)
We reuse the double-threshold switchover mechanism from BIP 34, with the same thresholds, but for nVersion = 3. The new rules are in effect for every block (at height H) with nVersion = 3 and at least 750 out of 1000 blocks preceding it (with heights H-1000..H-1) also have nVersion = 3. Furthermore, when 950 out of the 1000 blocks preceding a block do have nVersion = 3, nVersion = 2 blocks become invalid, and all further blocks enforce the new rules.
-
↩ History Strict DER had been relay policy in the reference client since v0.8.0, any non-compliant signature can be converted to a compliant one, and the BIP notes the added benefit of reducing malleability.
Quoted source text (1)
The requirement to have signatures that comply strictly with DER has been enforced as a relay policy by the reference client since v0.8.0, and very few transactions violating it are being added to the chain as of January 2015. In addition, every non-compliant signature can trivially be converted into a compliant one, so there is no loss of functionality by this requirement. This proposal has the added benefit of reducing transaction malleability (see BIP 62).
-
↩ a b Rule A high S can be trivially replaced by S' = n − S, with n = 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141.
Quoted source text (1)
A high S value in signature could be trivially replaced by <code>S' = 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141 - S</code>.
-
↩ a b Rule LOW_S: every signature passed to an ECDSA signature opcode, including P2WPKH, MUST have S between 0x1 and 0x7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 5D576E73 57A4501D DFE92F46 681B20A0, the curve order divided by 2; a non-empty signature that fails makes the script false immediately.
BIP 146 L38 BIP 146 L38 BIP 146 L40
Quoted source text (3)
We require that the S value inside ECDSA signatures is at most the curve order divided by 2 (essentially restricting this value to its lower half range).
MUST use a S value between <code>0x1</code> and <code>0x7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 5D576E73 57A4501D DFE92F46 681B20A0</code> (inclusive) with strict DER encoding
If a signature passing to ECDSA verification does not pass the Low S value check and is not an empty byte array, the entire script evaluates to false immediately.
-
↩ a b History BIP 146 records the reference client producing low-S signatures since v0.9.0, enforcing LOW_S as relay policy since v0.11.1 and NULLFAIL since v0.13.1, and very few violations reaching the chain as of August 2016.
Quoted source text (2)
The reference client has produced LOW_S compatible signatures since v0.9.0, and the LOW_S rule has been enforced as relay policy by the reference client since v0.11.1. As of August 2016, very few transactions violating the requirement are being added to the chain. For all scriptPubKey types in actual use, non-compliant signatures can trivially be converted into compliant ones, so there is no loss of functionality by these requirements.
The NULLFAIL rule has been enforced as relay policy by the reference client since v0.13.1.
-
↩ Rule NULLFAIL: when OP_CHECKSIG would return FALSE its signature must be empty, and when OP_CHECKMULTISIG would, every signature passed to it must be empty, even ones it skipped; otherwise the script fails immediately.
Quoted source text (1)
If an <code>OP_CHECKSIG</code> is trying to return a <code>FALSE</code> value to the stack, we require that the relevant signature must be an empty byte array. If an <code>OP_CHECKMULTISIG</code> is trying to return a <code>FALSE</code> value to the stack, we require that all signatures passing to this <code>OP_CHECKMULTISIG</code> must be empty byte arrays, even the processing of some signatures might have been skipped due to early termination of the signature verification. Otherwise, the entire script evaluates to false immediately.
-
↩ a b Rule BIP 141 keeps the txid as the double SHA-256 of the traditional serialization, without witness data, and defines the wtxid over the serialization with it.
Quoted source text (2)
Definition of <code>txid</code> remains unchanged: the double SHA256 of the traditional serialization format: [nVersion][txins][txouts][nLockTime]
A new <code>wtxid</code> is defined: the double SHA256 of the new serialization with witness data: [nVersion][marker][flag][txins][txouts][witness][nLockTime]
-
↩ a b Test vector In the model, flipping input 0's S changes both the txid and the wtxid of BIP 143's example; flipping input 1's leaves the txid and changes the wtxid. The flipped transactions still verify.
Quoted source text (2)
For non-segregated witness transactions, signature malleability will change the <code>txid</code>
Definition of <code>txid</code> remains unchanged: the double SHA256 of the traditional serialization format:
-
↩ History BIP 66 (Pieter Wuille), Strict DER signatures, a consensus soft fork assigned in 2015, is recorded as Deployed.
Quoted source text (1)
Layer: Consensus (soft fork) Title: Strict DER signatures Authors: Pieter Wuille <pieter.wuille@gmail.com> Status: Deployed Type: Specification Assigned: 2015-01-10
-
↩ History BIP 146 (Johnson Lau and Pieter Wuille), Dealing with signature encoding malleability, a consensus soft fork assigned in 2016, is recorded as Closed.
Quoted source text (1)
Layer: Consensus (soft fork) Title: Dealing with signature encoding malleability Authors: Johnson Lau <jl2012@xbt.hk> Pieter Wuille <pieter.wuille@gmail.com> Status: Closed Type: Specification Assigned: 2016-08-16
-
↩ History BIP 146's deployment section says it would use BIP 9 version bits and leaves the details, start time and timeout as TBD.
Quoted source text (2)
This BIP will be deployed by "version bits" [https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki BIP9]. Details TBD.
For Bitcoin mainnet, the BIP9 starttime will be midnight TBD UTC (Epoch timestamp TBD) and BIP9 timeout will be midnight TBD UTC (Epoch timestamp TBD).
-
↩ Rule BIP 146 says users MUST pay extra attention to these rules when designing exotic scripts.
Quoted source text (1)
Users MUST pay extra attention to these new rules when designing exotic scripts.
-
↩ History Both BIPs were extracted from BIP 62, an earlier proposal on malleability by Pieter Wuille that is recorded as Closed.
BIP 62 L6–8 BIP 66 L141 BIP 146 L132
Quoted source text (3)
Title: Dealing with malleability Authors: Pieter Wuille <pieter.wuille@gmail.com> Status: Closed
This document is extracted from the previous BIP62 proposal
This document is extracted from the previous [https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki BIP62] proposal which had input from various people.
-
↩ History After BIP 66 was adopted and enforced network-wide, its author disclosed that strict DER signatures had indirectly fixed a consensus bug he had found earlier.
Quoted source text (1)
that strict DER signatures provided an indirect solution to a consensus bug he had previously discovered.