deviant/scripts/extract_blocksize_war.py
walerikus 518a3ce174 chore: initial project baseline — full Deviant codebase under version control
Brings the whole project into git (previously only the on-ramp feature and
a few parallel files were tracked). Includes: wallet core (src/), CashScript
contracts/, the Capacitor shell (shells/), scripts/, tests, and the docs
corpus (wiki/, snapshots/, Parameters/, Archive/, KnowledgeBase text).

Excluded via .gitignore: node_modules/, dist/, .env (secrets), testnet WIF
key files (.chipnet-*.json, devWallets.ts), KnowledgeBase/RAW media (~9.6 GB),
transcripts/ (session logs), and machine-local config (.claude/*.local,
*.lock). Secret-scanned before commit — no credentials in the tree.

Note: src/swapMath.ts, src/swapBuilder.ts, contracts/OpenMintToken.cash are
legacy (OP_RETURN era) but still imported; committed as-is, flagged for a
separate removal once de-referenced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 20:38:07 +02:00

95 lines
5.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""Extract the block-size-war spine from Vol.13 (Bitcoin Discovery) into a
standalone 'Block Size Wars' document, WITHOUT modifying Vol.13.
Copies the war sections verbatim (III the block-size war, IV the split, V RBF,
VI SegWit, VII Lightning, XI what each chain represents now, XII BSV) plus the
full References section, reusing Vol.13's <head> styling. Original section
numbering is retained so cross-references stay stable against the parent volume;
a provenance callout explains it. Re-runnable / idempotent.
Usage: python scripts/extract_blocksize_war.py
"""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SRC = ROOT / "KnowledgeBase/03_historical_and_political_economic/vol13_bitcoin-history_FOR-sophisticated-readers-and-historical-analysts.html"
DST = ROOT / "KnowledgeBase/03_historical_and_political_economic/blocksize-war_FOR-sophisticated-readers-and-historical-analysts.html"
# SAFETY GUARD (added 2026-06-07): the destination has since been expanded by hand
# in a later session (front-arc §A–I, Cobra callout, §11 epigraph) well beyond this
# plain extract. Re-running this would CLOBBER that work. Refuse to overwrite an
# existing destination — delete it deliberately first if a fresh extract is truly
# wanted.
if DST.exists():
raise SystemExit(
f"REFUSING TO OVERWRITE: {DST.relative_to(ROOT)} already exists and has been "
f"expanded beyond this extract. Delete it deliberately first if you really "
f"want to regenerate the plain base."
)
lines = SRC.read_text(encoding="utf-8").split("\n")
def block(a, b): # 1-indexed inclusive line range -> string
return "\n".join(lines[a - 1:b])
# <head> (incl. all CSS) up to and including </head>
head = block(1, 842).replace(
"<title>DEVIANT · Vol.13 — Bitcoin Discovery</title>",
"<title>DEVIANT · The Block Size Wars</title>",
)
# War-spine sections, verbatim (original Vol.13 section numbering retained).
SECTIONS = [
(1046, 1338), # III The block-size war (How the consensus broke)
(1341, 1362), # IV August 2017 (The split at block 478,558)
(1365, 1450), # V RBF (The reversibility shift)
(1453, 1561), # VI SegWit (The validation shift)
(1564, 1663), # VII Lightning (The layer-2 distraction)
(1869, 1968), # XI Side-by-side (What each chain represents now)
(1971, 2043), # XII The third chain (Bitcoin SV)
]
sections = [block(a, b) for a, b in SECTIONS]
references = block(2111, 2198) # References (full — keeps all citations valid)
masthead = """<body>
<div class="frame">
<header class="master">
<div class="deviant-brand">Deviant</div>
<div class="vol-label">Companion extract · The block-size conflict</div>
<span class="vol-tag">BSW</span>
<h1>The Block Size <span class="accent">Wars.</span></h1>
<div class="subtitle">How the consensus broke, and what each chain became.</div>
<div class="descriptive">The social, political, and protocol-level conflict over Bitcoin's block-size limit — from the 2015 suppression of on-chain-scaling proposals to the August 2017 chain split and the divergences that followed.</div>
<div class="meta">
<span><strong>For:</strong> Sophisticated readers and historical analysts</span>
<span><strong>Date:</strong> May 2026</span>
<span><strong>Status:</strong> Extract / working draft — expansion in progress</span>
</div>
</header>
<p class="lede">A protocol is a specification; a chain is an implementation. The block-size war was the conflict over which of those two would govern the other. This document collects the war chronology and its protocol consequences, extracted from <strong>Vol.13 — Bitcoin Discovery</strong> for focused expansion. The conclusions about who did what, and why, are left to the reader.</p>
<div class="callout">
<div class="callout-label">On provenance and section numbering</div>
<p>This document is extracted from <strong>Vol.13 — Bitcoin Discovery</strong> and retains that volume's original section numbering (III, IV, V, …) so that cross-references remain stable against the parent text. Cross-references to sections not reproduced here — for example Section I (the whitepaper specification), Section II (pre-conflict consensus, 2009–2014), or Section IX (derivatives and leverage) — point to the parent volume. The material reproduced here is the war spine and its immediate protocol consequences; additional material is being added to this document directly.</p>
</div>
"""
footer = """
<footer>
<div>The Block Size Wars · extracted from Vol.13 · Bitcoin Discovery · May 2026</div>
<div class="note">The whitepaper is short. Anyone can read it. The chains are observable. The comparison is direct. Nothing here depends on trust.</div>
</footer>
</div>
</body>
</html>"""
out = head + "\n" + masthead + "\n" + "\n\n".join(sections) + "\n\n" + references + "\n" + footer
DST.write_text(out, encoding="utf-8")
print(f"wrote {DST.relative_to(ROOT)} ({len(out):,} chars, {out.count(chr(10)) + 1} lines)")
print(f"sections copied: {len(sections)} + references; Vol.13 left untouched")