Skip to content

Commit fd5a85d

Browse files
committed
Implement BIP 123 for BIP 90 (merging master)
2 parents 72f1891 + a7cc4c6 commit fd5a85d

11 files changed

+139
-6
lines changed

README.mediawiki

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ Those proposing changes should consider that ultimately consent may rest with th
344344
| Standard
345345
| Draft
346346
|-
347+
| [[bip-0090.mediawiki|90]]
348+
| Buried Deployments
349+
| Suhas Daftuar
350+
| Informational
351+
| Draft
352+
|-
347353
| [[bip-0099.mediawiki|99]]
348354
| Motivation and deployment of consensus rule changes ([soft/hard]forks)
349355
| Jorge Timón
@@ -385,12 +391,12 @@ Those proposing changes should consider that ultimately consent may rest with th
385391
| Washington Y. Sanchez
386392
| Standard
387393
| Draft
388-
|-
394+
|- style="background-color: #ffcfcf"
389395
| [[bip-0109.mediawiki|109]]
390396
| Two million byte size limit with sigop and sighash limits
391397
| Gavin Andresen
392398
| Standard
393-
| Draft
399+
| Rejected
394400
|- style="background-color: #ffffcf"
395401
| [[bip-0111.mediawiki|111]]
396402
| NODE_BLOOM service bit

bip-0017.mediawiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
This BIP describes a new opcode (OP_CHECKHASHVERIFY) for the Bitcoin scripting system, and a new 'standard' transaction type that uses it to enables the receiver of bitcoins to specify the transaction type needed to re-spend them.
1414

15+
==Copyright==
16+
17+
This BIP is licensed under the BSD 2-clause license.
18+
1519
==Motivation==
1620

1721
The purpose of pay-to-script-hash is to move the responsibility for supplying the conditions to redeem a transaction from the sender of the funds to the redeemer.

bip-0018.mediawiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
This BIP modifies the basic format of transaction inputs and outputs, replacing the current scriptSig and scriptPubKey (scripts executed to validate a transaction) with new contents: dataSig, scriptCheck, and hashScriptCheck.
1414

15+
==Copyright==
16+
17+
This BIP is licensed under the BSD 2-clause license.
18+
1519
==Motivation==
1620

1721
The purpose of pay-to-script-hash is to move the responsibility for supplying the conditions to redeem a transaction from the sender of the funds to the redeemer.

bip-0019.mediawiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
This BIP proposes M-of-N-signatures required transactions as a new 'standard' transaction type using the existing scripting system without significant modifications.
1414

15+
==Copyright==
16+
17+
This BIP is licensed under the BSD 2-clause license.
18+
1519
==Motivation==
1620

1721
Enable secured wallets, escrow transactions, and other use cases where redeeming funds requires more than a single signature.

bip-0020.mediawiki

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ BIP 0020 is based off an earlier document by Nils Schneider. '''And has been rep
1313
==Abstract==
1414
This BIP proposes a URI scheme for making Bitcoin payments.
1515

16+
==Copyright==
17+
This BIP is licensed under the BSD 2-clause license.
18+
1619
==Motivation==
1720
The purpose of this URI scheme is to enable users to easily make payments by simply clicking links on webpages or scanning QR Codes.
1821

bip-0022.mediawiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
This BIP describes a new JSON-RPC method for "smart" Bitcoin miners and proxies.
1414
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.
1515

16+
==Copyright==
17+
18+
This BIP is licensed under the BSD 2-clause license.
19+
1620
==Specification==
1721

1822
===Block Template Request===

bip-0023.mediawiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
This BIP describes extensions to the getblocktemplate JSON-RPC call to enhance pooled mining.
1414

15+
==Copyright==
16+
17+
This BIP is licensed under the BSD 2-clause license.
18+
1519
==Specification==
1620

1721
Note that all sections of this specification are optional extensions on top of [[bip-0022.mediawiki|BIP 22]].

bip-0067.mediawiki

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,8 @@ The authors wish to thank BtcDrak and Luke-Jr for their involvement & contributi
127127
128128
== References ==
129129
<references>
130+
131+
132+
== Copyright ==
133+
This document is placed in the public domain.
134+

bip-0090.mediawiki

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<pre>
2+
BIP: 90
3+
Layer: Consensus (hard fork)
4+
Title: Buried Deployments
5+
Author: Suhas Daftuar <[email protected]>
6+
Status: Draft
7+
Type: Informational
8+
Created: 2016-11-08
9+
</pre>
10+
11+
12+
==Abstract==
13+
14+
Prior soft forks (BIP 34, BIP 65, and BIP 66) were activated via miner signaling in block version numbers. Now that the chain has long since passed the blocks at which those consensus rules have triggered, we can (as a simplification) replace the trigger mechanism by caching the block heights at which those consensus rules became enforced.
15+
16+
==Motivation==
17+
18+
BIPs 34, 65 and 66 were deployed on mainnet using miner signaling using block version numbers. In short, new consensus rules were proposed for use in blocks with a higher version number (N+1) than the prevailing block version (N) in use on the network, and those rules became enforced under the following conditions:
19+
# 75% rule: If 750 of the prior 1000 blocks are version N+1 or higher, then blocks with version N+1 or higher must correctly enforce the new consensus rule.
20+
# 95% rule: If 950 of the prior 1000 blocks are version N+1 or higher, then blocks with version less than N+1 are invalid.
21+
22+
Please see those [[#References|BIPs]] for more details.
23+
24+
Note that this trigger mechanism is dependent on the chain history. To validate a block, we must test whether the trigger was met by looking at the previous 1000 blocks in the chain before it, which can be inefficient.
25+
26+
In addition, this mechanism for code deployments have been deprecated in favor of BIP 9 deployments, which offer several advantages (please see [https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki BIP 9]).
27+
28+
Thus we propose elimination of the logic implementing these kinds of deployments, by replacing the test which governs enforcement of BIP 34, BIP 65, and BIP 66 with simple height checks, which we choose to be the block height triggering the 95% activation rule on mainnet for each of those deployments. This simplification of the consensus rules would reduce the technical debt associated with deployment of those consensus changes.
29+
30+
==Considerations==
31+
32+
It is technically possible for this to be a non-backwards compatible change. For example, if an alternate chain were created in which BIP 34's 95% activation triggered at a lower height (H') than it did on the current mainnet chain (H), then older software would enforce that version 1 blocks were invalid at heights between H' and H, while newer software implementing this change would not. Similarly, this BIP proposes doing away with the 75% threshold check altogether, which means, for example, that a version 2 block forking off of mainnet at height H-1 which omitted the height in coinbase would be invalid to older software, while accepted by newer software.
33+
34+
However, while newer software and older software might validate old blocks differently, that could only cause a consensus split if there were an extremely large blockchain reorganization onto a chain built off such a block. As of November 2016, the most recent of these changes (BIP 65, enforced since December 2015) has nearly 50,000 blocks built on top of it. The occurrence of such a reorg that would cause the activating block to be disconnected would raise fundamental concerns about the security assumptions of Bitcoin, a far bigger issue than any non-backwards compatible change.
35+
36+
So while this proposal could <i>theoretically</i> result in a consensus split, it is extremely unlikely, and in particular any such circumstances would be sufficiently damaging to the Bitcoin network to dwarf any concerns about the effects of this proposed change.
37+
38+
==Specification==
39+
40+
The BIP 34, 66, and 65 activation heights are set to 227931, 363725, and 388381, respectively.
41+
42+
The 1000-block lookback test, first described in BIP 34, is no longer performed during validation of any blocks. Instead, a new check is added:
43+
44+
if((block.nVersion < 2 && nHeight >= consensusParams.BIP34Height) ||
45+
(block.nVersion < 3 && nHeight >= consensusParams.BIP66Height) ||
46+
(block.nVersion < 4 && nHeight >= consensusParams.BIP65Height))
47+
return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion),
48+
strprintf("rejected nVersion=0x%08x block", block.nVersion));
49+
50+
Furthermore, rather than consider the block versions of the prior 1000 blocks to determine whether to enforce BIP 34, BIP 65, or BIP 66 on a given block, we instead just compare the height of the block being validated with the stored activation heights:
51+
52+
// Enforce rule that the coinbase starts with serialized block height
53+
if (nHeight >= consensusParams.BIP34Height)
54+
{
55+
CScript expect = CScript() << nHeight;
56+
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||
57+
!std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin())) {
58+
return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase");
59+
}
60+
}
61+
62+
and
63+
64+
// Start enforcing the DERSIG (BIP66) rule
65+
if (pindex->nHeight >= chainparams.GetConsensus().BIP66Height) {
66+
flags |= SCRIPT_VERIFY_DERSIG;
67+
}
68+
69+
// Start enforcing CHECKLOCKTIMEVERIFY (BIP65) rule
70+
if (pindex->nHeight >= chainparams.GetConsensus().BIP65Height) {
71+
flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
72+
}
73+
74+
Please see the implementation for additional details.
75+
76+
==Implementation==
77+
78+
https://github.com/bitcoin/bitcoin/pull/8391.
79+
80+
81+
==References==
82+
83+
[https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki BIP34 Block v2, Height in Coinbase]
84+
85+
[https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki BIP66 Strict DER signatures]
86+
87+
[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65 OP_CHECKLOCKTIMEVERIFY]
88+
89+
[https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki BIP9 Version bits with timeout and delay]
90+
91+
==Acknowledgements==
92+
93+
Thanks to Nicolas Dorier for drafting an initial version of this BIP, and to Alex Morcos, Matt Corallo, and Greg Maxwell for suggestions and feedback.
94+
95+
==Copyright==
96+
97+
This document is placed in the public domain.

bip-0109.mediawiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Layer: Consensus (hard fork)
44
Title: Two million byte size limit with sigop and sighash limits
55
Author: Gavin Andresen <[email protected]>
6-
Status: Draft
6+
Status: Rejected
77
Type: Standards Track
88
Created: 2016-01-28
99
</pre>

0 commit comments

Comments
 (0)