Blocks accepted at different post-BIP34 heights have different coinbase scriptSigs
ProvedBitcoinUniqueness.coinbases_distinctFor two reachable states at next heights , both and , and blocks accepted on them: the coinbase scriptSigs differ. Each starts with its own height push, and if both pushes were prefixes of the same bytes the shorter would prefix the longer, forcing equal heights.
import Definitions.Def_BitcoinUniqueness import Definitions.Def_BitcoinSer import Definitions.Def_BitcoinHeader open BitcoinUniqueness BitcoinSer BitcoinBlockV2
theorem BitcoinUniqueness.coinbases_distinct (S₁ S₂ : ChainState) (b₁ b₂ : BitcoinSer.Block) (now₁ now₂ : Int)
(S₁' S₂' : ChainState) (undo₁ undo₂ : BlockUndo)
(hR₁ : BitcoinBlockV2.Reachable S₁) (hR₂ : BitcoinBlockV2.Reachable S₂)
(h₁ : BitcoinBlockV2.validate S₁ b₁ now₁ = .accept S₁' undo₁) (h₂ : BitcoinBlockV2.validate S₂ b₂ now₂ = .accept S₂' undo₂)
(h34₁ : BitcoinHeader.BIP34Height ≤ S₁.nextHeight) (h34₂ : BitcoinHeader.BIP34Height ≤ S₂.nextHeight)
(hlt₁ : S₁.nextHeight < 2 ^ 31) (hlt₂ : S₂.nextHeight < 2 ^ 31) (hne : S₁.nextHeight ≠ S₂.nextHeight) :
BitcoinUniqueness.coinbaseScriptSig b₁ ≠ BitcoinUniqueness.coinbaseScriptSig b₂ := by sorryRead-back
What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinUniqueness.coinbases_distinct
Statement. For all chain states , blocks , integers (clock readings), chain states , and undo lists , if
- and ,
- and ,
- and ,
- and , and
- ,
then (the two byte strings are not equal).
Formally, with :
What coinbaseScriptSig says
is the scriptSig (a byte string) of the first input of the first transaction of , with two fallbacks: if is empty, the fixed genesis coinbase transaction stands in for the first transaction (its scriptSig is a fixed 77-byte string); if that transaction has no inputs, a default input with empty scriptSig stands in, giving the empty string.
What the acceptance hypothesis says
asserts that the four stages below all succeed and that and are exactly the state and undo list they produce. Write , (the next height), for the last element of (the fixed genesis header if the list is empty), (truncated subtraction, so when ), and for the first transaction of (the fixed genesis coinbase transaction if is empty). A transaction "is a coinbase" iff it has exactly one input and that input's previous outpoint is .
-
Header stage. passes the proof-of-work test of the imported proof-of-work development (its double-SHA-256 hash, read as a little-endian 256-bit number, against the 32-bit field ); equals the header hash of (otherwise the outcome is "missing previous", not accept); the 32-bit value of equals the required work computed from by the imported difficulty rule; the median time past of at is strictly less than ; (otherwise the outcome is "future time", not accept); and it is not the case that ( and ), nor ( and ), nor ( and ).
-
Context-free block stage. The proof-of-work test again; the Merkle root computed from the txids of equals and the Merkle computation reports no mutation; is non-empty; and ; is a coinbase and no other transaction of is; every transaction has non-empty inputs and outputs, witness-stripped size times 4 at most , every output value in with running totals in that range, pairwise distinct previous outpoints, and (for a coinbase) a first-input scriptSig of length between and inclusive, or (for a non-coinbase) no null previous outpoint; and of the legacy signature-operation counts is at most .
-
Contextual stage. Every transaction of is final at height against a cutoff (the median time past of if , else ); if then is a prefix of the scriptSig of the first input of (the first input being the default input with empty scriptSig if has no inputs) — this byte string is literally the same expression as ; the witness-malleation check passes with the expectation flag set iff ; and the block weight ( stripped size full size) is at most .
-
Connect stage. Let . If equals the fixed genesis block hash (32 bytes beginning ), the stage succeeds immediately with ledger and empty undo list, performing no further check. Otherwise: if (see the ScanRuns unfolding) and it is not the case that for every and every the ledger has no entry keyed , the stage fails; otherwise the transactions are processed in order through the imported per-transaction loop (input lookup and maturity, fee range, sequence locks, sigop budget, full script verification, ledger update), which must succeed, and finally the output value of must be at most the accumulated fees plus the subsidy at height .
On success, where is the ledger produced by stage 4, and is the undo list produced by stage 4. In particular .
What reachability says
is the least predicate such that (i) the initial state (one header, empty ledger) is reachable, and (ii) whenever is reachable and for some block , integer and undo list , then is reachable. So means arises from the initial state by a finite sequence of accepted validations, each with its own arbitrary clock reading.
Edge cases and scope
- The two chain states are related by no hypothesis: they need not share any header, need not be on the same chain, and need not be each other's ancestor; the only link between the two halves is .
- The two clock readings are independent and arbitrary.
- The conclusion compares only the first-input scriptSig of the first transaction of each block (with the fallbacks of , which the validation hypotheses' stage 2 prevents from being exercised). It says nothing about txids, about the rest of the coinbase transaction, or about blocks at the same height on different chains ( is excluded by hypothesis, so nothing is claimed about it).
- The heights are lengths of header lists of the pre-block states, bounded below by and strictly above by .
- appear only in the acceptance hypotheses.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.