@@ -21,22 +21,20 @@ case block validation time, prevent Merkle tree weaknesses, and avoid duplicate
2121This proposal addresses a number of long-standing vulnerabilities and weaknesses in the Bitcoin
2222protocol. Bundling these fixes together amortizes the fixed cost of deploying a Bitcoin soft fork.
2323
24- The timewarp bug permits a majority hashrate attacker to arbitrarily increase the block rate,
25- allowing them to steal block subsidy from future miners and increase validation costs to nodes that
26- have to deal with the increased average transaction rate. By strategically setting the block
27- timestamp, the [ timewarp bug] [ SE timewarp ] lets miners bring down the difficulty to its minimum
28- within 38 days of starting the attack. The existence of this bug not only significantly empowers a
29- 51% attacker, but also makes it notably harder to reason about miners' incentives. It could indeed
30- be in the interest of short-sighted miners as well as short-sighted users to exploit this
31- vulnerability in a small enough proportion to increase the block rate without fatally hurting the
32- network, as the effectively increased block space would — all other things being equal — bring fee
33- rates down for users.
34-
35- Specially crafted blocks may be expensive to process, with validation times ranging from a few
36- minutes up to more than an hour on lower-end devices. Long block validation times are a nuisance to
37- users, increasing the cost to independently fully validate the consensus rules. In addition they can
38- be used by miners to attack their competition, creating perverse incentives, centralization
39- pressures and leading to reduced network security.
24+ The [ timewarp bug] [ SE timewarp ] makes it possible for a majority-hashrate attacker to arbitrarily
25+ lower mining difficulty, and therefore arbitrarily increase the block rate. In the worst case, an
26+ attacker can bring down the difficulty to its minimum within 38 days of starting the attack. Besides
27+ empowering a 51% attacker, the presence of this bug makes it harder to reason about miners'
28+ incentives. Accelerating the block rate allows an attacker to steal block subsidy from future
29+ miners and increases available block space. It may be in the interest of short-sighted users and
30+ miners to exploit this vulnerability to materially increase the block rate without fatally hurting
31+ the network.
32+
33+ Specially crafted blocks may be expensive to process, [ taking up to] [ Delving worst block ] several
34+ minutes to validate even on high-end devices, and up to a few hours on lower-end devices. Long block
35+ validation times are a nuisance to users, increasing the cost to independently fully validate the
36+ consensus rules. In addition they can be used by miners to attack their competition, creating
37+ perverse incentives, centralization pressures and leading to reduced network security.
4038
4139In computing a block's Merkle root, a transaction with exactly 64 bytes of non-witness data can be
4240interpreted both as an intermediate node in the tree and as a leaf in the tree. This makes it
@@ -47,12 +45,10 @@ any other user of Merkle proofs, to rely on one of the available workarounds[^13
4745necessary in the first place.
4846
4947Since [ bip-0034] [ BIP34 ] activation, explicit [ bip-0030] [ BIP30 ] validation is not necessary until
50- block height 1,983,702[ ^ 0 ] . Mandating new coinbase transactions be different from the early
51- [ bip-0034] [ BIP34 ] violations makes it possible to get rid of [ bip-0030] [ BIP30 ] validation forever.
52- Besides its unnecessary cost, another downside of [ bip-0030] [ BIP30 ] validation is that it cannot be
53- performed by Utreexo clients. Finally, leveraging the coinbase transaction's ` nLockTime ` field
54- allows applications to recover the block height corresponding to a coinbase transaction without
55- having to parse Script.
48+ block height 1,983,702[ ^ 0 ] . Resuming [ bip-0030] [ BIP30 ] validation would unnecessarily increase block
49+ validation overhead and preclude alternative full node designs (such as [ bip-0182] [ BIP182 ] Utreexo).
50+ Enforcing that new coinbase transactions are different from the early [ bip-0034] [ BIP34 ] violations
51+ makes it possible to get rid of [ bip-0030] [ BIP30 ] validation forever.
5652
5753## Specification
5854
@@ -116,17 +112,19 @@ invalidating 64-byte transactions, fixing the vulnerability without Merkle proof
116112rely on any workaround or even know one is necessary in the first place. See [ this post] [ 64 bytes
117113debate] for an attempt at summarizing the arguments for both sides of this debate.
118114
119- Several blocks prior to [ bip-0034] [ BIP34 ] activation contain a coinbase transaction whose scriptSig
120- contains a valid [ bip-0034] [ BIP34 ] commitment to a future block height. This offers an opportunity
121- to duplicate these coinbase transactions in the future[ ^ 10 ] and for this reason [ bip-0030] [ BIP30 ]
122- validation will need to be re-activated from block 1,983,702. A simple way to prevent this is to
123- mandate that future coinbase transactions vary from coinbase transactions before [ bip-0034] [ BIP34 ]
124- activation. There are multiple ways of achieving this, but setting and enforcing the timelock for
125- the coinbase transaction makes it so all coinbase transactions past Consensus Cleanup activation
126- could not have been valid before this height and therefore cannot be a duplicate[ ^ 11 ] . This
127- simplifies both reasoning and client implementation, since the [ bip-0030] [ BIP30 ] check can be
128- skipped entirely past Consensus Cleanup activation, regardless of the [ bip-0034] [ BIP34 ] activation
129- status[ ^ 12 ] .
115+ The ` nLockTime ` field of transactions is a natural place to store a block height and is currently
116+ unused in coinbase transactions. Using it to enforce that new coinbase transactions differ from
117+ early [ bip-0034] [ BIP34 ] violations also allows applications to recover the block height without
118+ having to parse Script. Leveraging the existing timelock mechanism makes the check self-contained:
119+ the same coinbase transaction cannot have been valid in a previous block[ ^ 11 ] . This simplifies both
120+ reasoning and client implementation, since the [ bip-0030] [ BIP30 ] check can be skipped entirely past
121+ Consensus Cleanup activation, regardless of the [ bip-0034] [ BIP34 ] activation status[ ^ 12 ] . One person
122+ [ raised the concern] [ miningdev nLockTime ] that the ` nLockTime ` field would be an ideal extranonce
123+ for ASIC controllers if such controllers ever became a bottleneck in mining operations. Others
124+ [ replied] [ miningdev nLockTime ] that the same benefits could be achieved by using a dummy output
125+ instead, should that ever become necessary. The authors [ believe] [ ML remaining concerns ] the
126+ benefits of using ` nLockTime ` to differentiate coinbase transactions outweigh the theoretical
127+ cost of making it unavailable for extranonce rolling by ASIC controllers.
130128
131129## Backward compatibility
132130
@@ -217,8 +215,6 @@ implemented caching that made it vulnerable to this attack. See [this writeup][S
217215Suhas Daftuar for a detailed explanation. Invalidating 64-byte transactions may avoid this risk, but
218216the issue is largely orthogonal to this proposal: it is fundamentally about caching validation
219217status for malleable blocks.
220- [ ^ 10 ] : See [ here] [ BIP34 list ] for a full list of the heights of historical blocks including a valid
221- bip-0034 height commitment and the corresponding future block height.
222218[ ^ 11 ] : Technically it could be argued a duplicate could in principle always be possible before block
22321931,001 when ` nLockTime ` enforcement [ was originally soft-forked] [ Harding nLockTime ] . But treating
224220coinbase transactions as not having duplicate past Consensus Cleanup activation would be consistent
@@ -236,7 +232,9 @@ post]. A third workaround is to change the Merkle proof structure by requiring i
236232provided as the single-SHA256 of their preimage, instead of the double-SHA256. See [ here] [ Sergio
237233MERKLEBLOCK] for a full description.
238234
235+ [ Delving worst block ] : https://delvingbitcoin.org/t/great-consensus-cleanup-revival/710/93
239236[ BIP30 ] : https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki
237+ [ BIP182 ] : https://github.com/bitcoin/bips/pull/1923
240238[ BIP-XXXX ] : https://github.com/TheBlueMatt/bips/blob/7f9670b643b7c943a0cc6d2197d3eabe661050c2/bip-XXXX.mediawiki
241239[ BIP34 ] : https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki
242240[ BIP16 specs ] : https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#specification
@@ -252,11 +250,12 @@ MERKLEBLOCK] for a full description.
252250[ Sergio post ] : https://bitslog.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design
253251[ Sergio MERKLEBLOCK ] : https://bitslog.com/2018/08/21/simple-change-to-the-bitcoin-merkleblock-command-to-protect-from-leaf-node-weakness-in-transaction-merkle-tree/
254252[ 64 bytes debate ] : https://delvingbitcoin.org/t/great-consensus-cleanup-revival/710/41
255- [ BIP34 list ] : https://delvingbitcoin.org/t/great-consensus-cleanup-revival/710/4
256253[ Harding nLockTime ] : https://bitcoin.stackexchange.com/questions/90229/nlocktime-in-bitcoin-core
257254[ Delving duplicable ] : https://delvingbitcoin.org/t/great-consensus-cleanup-revival/710/4
258255[ Core 0.16.1 ] : https://bitcoincore.org/en/releases/0.16.1
259256[ Core 29.0 ] : https://bitcoincore.org/en/releases/29.0
260257[ inquisition-implem ] : https://github.com/darosior/bitcoin/tree/2509_inquisition_consensus_cleanup
261258[ Core 30.0 ] : https://bitcoincore.org/en/releases/30.0
262259[ Core validation.cpp BIP34 ] : https://github.com/bitcoin/bitcoin/blob/390e7d61bd531505bb3d13f38316c282b85ed1dd/src/validation.cpp#L2401-L2459
260+ [ miningdev nLockTime ] : https://groups.google.com/g/bitcoinminingdev/c/jlqlNHHNSNk
261+ [ ML remaining concerns ] : https://gnusha.org/pi/bitcoindev/UsKuvCXXhSAnNVx5a0K2UfP3srAr3slW9mcOjtYk9LnolaOXfWrW9jpqbxsQQPkyQuZogkhz2Hbfwii2VsTm79vRDpgKduxk35hpBu_t7Do=@protonmail.com/
0 commit comments