Great Consensus Cleanup

From Bitcoin Wiki
Jump to navigation Jump to search

The Great Consensus Cleanup is a proposed Bitcoin soft fork specified as BIP 54 ("Consensus Cleanup") by Antoine Poinsot and Matt Corallo. It would tighten four long-standing consensus edge cases: a timewarp attack that manipulates difficulty retarget timestamps, worst-case legacy signature-operation cost, 64-byte transaction ambiguity in the Merkle tree, and future duplicate coinbases that would force a return to BIP 30 validation. The BIP status is Complete. It is not a mainnet consensus rule. No activation parameters have been assigned.

Matt Corallo posted an earlier cleanup draft in 2019. Antoine Poinsot revived the work on Delving Bitcoin in 2024 after measuring validation-time attacks and restating the timewarp incentive problem. The BIP number was assigned in April 2025. Status was advanced to Complete after test vectors and a reference implementation existed, which in the BIP process means the authors consider the rules ready for an activation discussion, not that miners have activated them. Each item restricts currently valid blocks. The bundle is meant to amortize the coordination cost of a soft fork that adds no new Script features.

After an activation height, four rules would apply. If the block height N is divisible by 2016, nTime must be at least the previous block's timestamp minus 7200 seconds. If N modulo 2016 equals 2015, nTime must be at least the timestamp of the block at height N minus 2015, so that a difficulty period cannot have negative duration. The two-hour grace is looser than the 600-second bound used on Testnet4, after broken pool software on testnet produced timestamps that would have violated a ten-minute grace. Median-time-past still applies.

Non-coinbase transactions may not exceed 2500 signature operations counted as in BIP 16: each CHECKSIG counts as one, and CHECKMULTISIG counts as 1 to 16 or as 20 depending on the preceding opcode, whether or not the opcode executes. The cap is the tightest value the authors found that left non-pathological standard transactions valid. It targets constructions that made some blocks take minutes to hours to validate on ordinary hardware. It does not disable opcodes.

A transaction whose witness-stripped serialized size is exactly 64 bytes is invalid. A 64-byte serialization can be read either as a leaf (a txid) or as an inner Merkle node (two 32-byte hashes). That ambiguity lets an SPV verifier be shown a proof for a transaction that is not in the block. Such transactions are anyone-can-spend or unspendable, have been nonstandard since 2018–2019, and have not been used on mainnet since 2016. Invalidating them removes the ambiguity for proofs of every other transaction without requiring light clients to apply a workaround.

The coinbase's nLockTime must equal the block height minus 1, and nSequence must not be 0xffffffff. Combined with existing locktime semantics, that forces each new coinbase to differ from early BIP 34 violations and from previous coinbases. Nodes can then skip BIP 30 duplicate-txid checks after activation, including at the future heights where a BIP 34-era coinbase could otherwise reappear. The rule also lets software recover the height without parsing the coinbase script.

See also

External links