diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f15e59..51e7702 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,10 @@ jobs: - name: Verify committed SHA-256 checksums run: sha256sum -c SHA256SUMS.txt - - name: Run 17-test cryptographic, consensus & adversarial security suite + - name: Run 18-test cryptographic, consensus & adversarial security suite run: node tests/test_vault.js - name: Verify offline clean rebuild & zero unexpected drift run: | python3 build.py - git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt + git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt assets/ diff --git a/README.md b/README.md index e3ea558..82e4161 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ SegWit v0 P2WSH · BIP-68 CSV · BIP-174 PSBT · BIP-380 Miniscript · BBQr Airgap · OpenTimestamps · Zero Custody

-> **Timestamped in Bitcoin ([OpenTimestamps](https://opentimestamps.org)):** Clawback v1.0 release checksums ([`SHA256SUMS.txt`](SHA256SUMS.txt), SHA-256 `e44e7a8dd2fe70567b7151e616fb6fe5c63cc70ec2bd29820e8b922523131fc1` — covering standalone `clawback.html` `3b0a5dd8…687c7607`, `index.html`, `sw.js`, and `manifest.webmanifest`) are cryptographically anchored in **Bitcoin Block [`978,244`](https://mempool.space/block/000000000000000000019db39c8d2b067d0611b036c3ff9fa5a026bdbcc88dde)** (**30 November 2026 at 21:39:19 UTC**, Merkle root `76d264f2…a09222c9`). The upgraded, complete proof is committed in [`SHA256SUMS.txt.ots`](SHA256SUMS.txt.ots) — verify locally with `ots verify SHA256SUMS.txt.ots` or online at [opentimestamps.org](https://opentimestamps.org). +> **Timestamped in Bitcoin ([OpenTimestamps](https://opentimestamps.org)):** Clawback v1.0 release checksums at commit [`69b9035`](https://github.com/Random21m/clawback/commit/69b9035fa7ee427f7fc0616c471bb4e7a316d787) ([`SHA256SUMS.txt`](SHA256SUMS.txt), SHA-256 `e44e7a8dd2fe70567b7151e616fb6fe5c63cc70ec2bd29820e8b922523131fc1` — covering standalone `clawback.html` `3b0a5dd8…687c7607`, `index.html`, `sw.js`, and `manifest.webmanifest`) are cryptographically anchored in **Bitcoin Block [`978,244`](https://mempool.space/block/000000000000000000019db39c8d2b067d0611b036c3ff9fa5a026bdbcc88dde)** (**30 November 2026 at 21:39:19 UTC**, Merkle root `76d264f2…a09222c9`). The upgraded, complete proof is committed in [`SHA256SUMS.txt.ots`](SHA256SUMS.txt.ots) — verify locally with `git show 69b9035:SHA256SUMS.txt > SHA256SUMS.txt && ots verify SHA256SUMS.txt.ots` (later commits rebuild the files and carry newer checksums; the proof attests the checksum file as of that commit) or online at [opentimestamps.org](https://opentimestamps.org).

@@ -114,7 +114,7 @@ Scan inputs with your camera (`jsQR` + multi-frame BBQr reassembly) and beam Fun Load your watch-only `panic-only.json` on your phone or desktop with **zero private keys**. Point it at `mempool.space` or your own **Umbrel / Start9 Esplora node** for full privacy:

- Clawback Watchtower & Panic Dashboard — Multi-Slot Monitoring, Custom Esplora Node, and 3-Tier Clawback Controls + Clawback Watchtower & Panic Dashboard — Multi-Slot Monitoring, Custom Esplora Node, and Tiered Clawback Controls

@@ -191,8 +191,8 @@ node tests/test_vault.js ### Independent Verification & Rehearsals Clawback's transaction engine has been verified against both our strict consensus suite and independent third-party Bitcoin libraries: -* **17/17 Strict Consensus & Adversarial Security Tests (`node tests/test_vault.js`):** Official Bitcoin Core SHA-256, HASH160, BIP-32, Bech32m, and BIP-380 checksum vectors; hard-block of Legacy `1…`/`3…` funding inputs; full `BIP32_DERIVATION` propagation across all 3 PSBTs; strict `MINIMALIF` / `CLEANSTACK` / `BIP-66 DER` / `LOW_S` / `BIP-68 CSV` script evaluator (including early-spend rejection); adversarial tamper & 1-of-2 script backdoor detection; Coldcard BBQr mod-8 lossless multi-frame PSBT round-trip. -* **Independent Cross-Library Stress Fuzz:** Verified bit-for-bit across **60 fuzzed vaults / 120 slots / 180 PSBTs / 452 Clawbacks / 120 BBQr round-trips** against **`@scure/btc-signer`** (independently parsing, signing, and finalizing Funding PSBTs and 2-of-2 Unvault Partial PSBTs with identical TXIDs), **`@scure/bip32`**, **`@noble/curves/secp256k1`** (`lowS: true`), and **live `mempool.space`** Mainnet & Signet Esplora APIs. +* **18/18 Strict Consensus & Adversarial Security Tests (`node tests/test_vault.js`):** Official Bitcoin Core SHA-256, HASH160, BIP-32, Bech32m, and BIP-380 checksum vectors; hard-block of Legacy `1…`/`3…` funding inputs; full `BIP32_DERIVATION` propagation across all 3 PSBTs; strict `MINIMALIF` / `CLEANSTACK` / `BIP-66 DER` / `LOW_S` / `BIP-68 CSV` script evaluator (including early-spend rejection); adversarial tamper & 1-of-2 script backdoor detection; Coldcard BBQr mod-8 lossless multi-frame PSBT round-trip. +* **Independent Cross-Library Stress Fuzz (run externally; the harness is not part of this repository):** Verified bit-for-bit across **60 fuzzed vaults / 120 slots / 180 PSBTs / 452 Clawbacks / 120 BBQr round-trips** against **`@scure/btc-signer`** (independently parsing, signing, and finalizing Funding PSBTs and 2-of-2 Unvault Partial PSBTs with identical TXIDs), **`@scure/bip32`**, **`@noble/curves/secp256k1`** (`lowS: true`), and **live `mempool.space`** Mainnet & Signet Esplora APIs. --- diff --git a/SECURITY.md b/SECURITY.md index 9e03784..114119a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -11,5 +11,5 @@ Please report suspected vulnerabilities privately via GitHub's **Security → Report a vulnerability** (private vulnerability reporting) on this repository, and do not open a public issue for fund-impacting bugs. Include the affected commit/SHA-256, reproduction steps and impact. ## What Is Safe to Store Online -* **Panic-Only JSON / QR:** Contains only public watch addresses and finalized `Clawback TX` hexes hardcoded to pay your bunker address. Even if stolen, an attacker cannot redirect a single sat. +* **Panic-Only Package (`panic-only.json`) / QR:** Contains only public watch addresses and finalized `Clawback TX` hexes hardcoded to pay your bunker address. Even if stolen, an attacker cannot redirect a single sat. * **Vault Package JSON:** Because the vault uses 2-of-2 (`Primary Key + Ephemeral Key`), stealing the Vault Package alone still cannot trigger an unvault without your primary hardware wallet. diff --git a/SHA256SUMS.txt b/SHA256SUMS.txt index e02fc53..bcca48e 100644 --- a/SHA256SUMS.txt +++ b/SHA256SUMS.txt @@ -1,4 +1,4 @@ -9684e3922a93f225051d290309ba54b3d7290be824e6b17a62551fc01370e135 clawback.html -fea46b1c9617b99be3e38eeef30f707697b4d485aca79d4c1d28a6558d782975 index.html -b48459f1b5730ccc3656689b5f9cb470f0a94268528d40d00058f291c0569bbf sw.js -c98a5d9112489acd8d72a90b9227883d757384ecc971b75f877becd3417fcbf9 manifest.webmanifest +30ae80944a6de5672d896466f6644fb7e91ca0cafdcb36e76f0d81579cee70cc clawback.html +9370eb86a94de6d39b041daa9bf501319c8441890903e75e14de54f84b23ab41 index.html +b1a3be025e82e661f659c54a85e048ac7fc5db049163d434defe8bbf879ebeb6 sw.js +fa0318c50581e62ac668c861532aa17ea8c620b6cb62e257bf2e262b638f1e53 manifest.webmanifest diff --git a/TUTORIAL.md b/TUTORIAL.md index 544eeb4..8d3dc80 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -164,7 +164,7 @@ Every transaction generated by Clawback strictly complies with all Bitcoin Core 2. `` pushes the 33-byte ephemeral public key. Stack: `[ sig_ephem, ephemPub ]`. 3. `OP_CHECKSIG` verifies the pre-signed signature from `k_ephem` and pushes `0x01`. 4. `OP_ENDIF` finishes execution. Stack contains **1 truthy item (`0x01`)** → passes `CLEANSTACK`. -* **Why nobody can hijack Path 2:** Because `k_ephem` was permanently zeroed in RAM before funding, **only three valid signatures for Path 2 exist in the universe**—the `15`, `50`, and `200 sat/vB` Clawback transactions—and every single one pays **exclusively** to your hardcoded bunker address. +* **Why nobody can hijack Path 2:** Because `k_ephem` was permanently zeroed in RAM before funding, **only a handful of valid signatures for Path 2 exist in the universe**—the `15`, `50`, `200` (and, on larger slots, `500`) `sat/vB` Clawback transactions—and every single one pays **exclusively** to your hardcoded bunker address. ### 2.3 Why Native SegWit Funding Inputs & Non-RBF Are Enforced @@ -174,17 +174,18 @@ Pre-signed covenants depend on knowing `fundingTxid` *before* your hardware wall * **Legacy (`1…` P2PKH) & Wrapped (`3…` P2SH):** Signing populates `scriptSig`, which **mutates `fundingTxid`** and permanently invalidates the pre-signed `Unvault TX`. Clawback therefore **hard-blocks** non-Native-SegWit funding inputs in code. * **Non-RBF Funding Sequence (`0xffffffff`):** Prevents wallets from accidentally RBF-replacing the Funding TX with a different fee/change output (which would also change `fundingTxid`). -### 2.4 Why 3-Tier Pre-Signed Clawback Fees Defeat Mempool Spikes +### 2.4 Why Multi-Tier (Up to 4) Pre-Signed Clawback Fees Defeat Mempool Spikes -If an attack happens during a bull-run fee spike (e.g., 120 sat/vB), a single low-fee pre-signed clawback could get stuck in the mempool. Before deleting `k_ephem`, Clawback pre-signs **three complete, finalized RBF Clawback transactions** per slot: +If an attack happens during a bull-run fee spike (e.g., 120 sat/vB), a single low-fee pre-signed clawback could get stuck in the mempool. Before deleting `k_ephem`, Clawback pre-signs **up to four complete, finalized RBF Clawback transactions** per slot (the 500 sat/vB tier is skipped on slots where it would consume too large a share): -| Clawback Tier | Target Fee Rate | Approx. Fee (≈121–138 vB) | When to Use | +| Clawback Tier | Target Fee Rate | Approx. Fee (≈121–133 vB, from the code size model) | When to Use | | :--- | :---: | :---: | :--- | -| **Standard** | `15 sat/vB` | ≈2,070 sats | Quiet mempool (1–15 sat/vB) | -| **Fast** | `50 sat/vB` | ≈6,900 sats | Busy mempool (15–50 sat/vB) | -| **Urgent** | `200 sat/vB` | ≈27,600 sats | Extreme congestion / race against timer | +| **Standard** | `15 sat/vB` | ≈1,815–2,000 sats | Quiet mempool (1–15 sat/vB) | +| **Fast** | `50 sat/vB` | ≈6,050–6,650 sats | Busy mempool (15–50 sat/vB) | +| **Urgent** | `200 sat/vB` | ≈24,200–26,600 sats | Extreme congestion / race against timer | +| **Extreme** | `500 sat/vB` | ≈60,500–66,500 sats | Skipped on small slots (fee > 35% of the quarantined amount) | -Because all three spend the identical `unvaultTxid:0` outpoint with `nSequence = 0xfffffffd`, you can start with Standard or Fast and **instantly RBF-upgrade to Urgent (200 sat/vB)** with one click if fees surge—with zero separate CPFP wallet required. +Because all of them spend the identical `unvaultTxid:0` outpoint with `nSequence = 0xfffffffd`, you can start with Standard or Fast and **instantly RBF-upgrade to Urgent (200 sat/vB)** with one click if fees surge—with zero separate CPFP wallet required. --- @@ -240,7 +241,7 @@ Before touching a hardware wallet or a single real satoshi, rehearse the complet ### Walkthrough 1. Open **1. Live Simulator**. Set Simulated Vault Amount to `1.0` BTC and Quarantine Delay to **`7 Days · 1,008 blk`**. 2. Click **`Step 1: Seal Vault & Destroy Temp Key`**: - * Watch the Cryptographic Execution Log generate disposable Coldcard + SeedSigner keys, build the 2-of-2 P2WSH Vault address, pre-sign `Unvault TX` + 3 Clawback tiers, **wipe the ephemeral private key to zero in RAM**, and pass the full self-audit. + * Watch the Cryptographic Execution Log generate disposable Coldcard + SeedSigner keys, build the 2-of-2 P2WSH Vault address, pre-sign `Unvault TX` + up to 4 Clawback tiers, **wipe the ephemeral private key to zero in RAM**, and pass the full self-audit. * **Stage 01 (Sealed Vault)** lights up sage-teal. 3. Click **`Simulate Thief Steals Coldcard`**: * Simulates the worst-case scenario: an attacker with both your Coldcard and Vault Package signs and broadcasts `Unvault TX`. @@ -294,7 +295,7 @@ A vault is only as strong as the independence between your **Primary Spending Ke If you lock `2.0 BTC` into a single vault slot and later need `0.15 BTC` to buy a car, unvaulting exposes the entire `2.0 BTC` to the quarantine window. -Clawback solves this with **Multi-Slot Vaults**: a single Funding TX splits your whole wallet into **2, 3, or custom independent slots**—for example, `15% / 35% / 50%` (`0.3 BTC`, `0.7 BTC`, `1.0 BTC`). Each slot gets its own unique ephemeral key, its own 2-of-2 Vault address, its own Unvault Partial PSBT, and its own 3 Clawback transactions. When you need `0.3 BTC`, you unvault **only Slot #1** while `1.7 BTC` remains untouched. +Clawback solves this with **Multi-Slot Vaults**: a single Funding TX splits your whole wallet into **2, 3, or custom independent slots**—for example, `15% / 35% / 50%` (`0.3 BTC`, `0.7 BTC`, `1.0 BTC`). Each slot gets its own unique ephemeral key, its own 2-of-2 Vault address, its own Unvault Partial PSBT, and its own set of up to 4 Clawback transactions. When you need `0.3 BTC`, you unvault **only Slot #1** while `1.7 BTC` remains untouched. --- @@ -398,7 +399,7 @@ You have **three ways** to load funding inputs—all strictly enforce **Native S Switch to **Tab 3: Watchtower & Panic** on your daily phone (installed as a PWA) or laptop.

- Watchtower & Panic Dashboard Monitoring a 3-Slot Vault with Custom Esplora URL and 3-Tier Clawback Controls + Watchtower & Panic Dashboard Monitoring a 3-Slot Vault with Custom Esplora URL and Tiered Clawback Controls

### 8.1 Loading Your Watch-Only Panic Package @@ -491,7 +492,7 @@ Before funding any vault—or years later when auditing backups—load your `vau * Every slot's Quarantine script matches **Canonical Miniscript** byte-for-byte * Every slot's BIP-380 Vault & Quarantine Output Descriptor checksums are valid * Every slot's ephemeral `Unvault TX` signature verifies under BIP-143 ECDSA -* Every Clawback tier (`Standard`, `Fast`, `Urgent`) spends `unvaultTxid:0`, pays **exclusively** your exact bunker address, and passes BIP-143 ECDSA verification +* Every Clawback tier (`Standard`, `Fast`, `Urgent`, and `Extreme` when present) spends `unvaultTxid:0`, pays **exclusively** your exact bunker address, and passes BIP-143 ECDSA verification * All ephemeral private keys are attested zeroed in RAM ### 11.2 Zero-Lock-In Disaster Recovery (If Clawback Disappears in 2045) diff --git a/build.py b/build.py index 799d314..fe0bc01 100644 --- a/build.py +++ b/build.py @@ -169,8 +169,10 @@ def render_canvas(opaque_square=False): opaque_img.resize((180, 180), Image.Resampling.LANCZOS).save(ASSETS / "apple-touch-icon.png", "PNG", optimize=True) -def build(): - generate_crab_icons() +def build(regenerate_icons=False): + # PNG output depends on the Pillow version, so icons are only regenerated on request (--icons) + if regenerate_icons: + generate_crab_icons() html = (SRC / "index.html").read_text(encoding="utf-8") css = (SRC / "styles.css").read_text(encoding="utf-8") @@ -205,6 +207,7 @@ def build(): ' \n' f' \n' ) + assert " Clawback\n" in offline_html, "Missing anchor for standalone marker" offline_html = offline_html.replace(" <title>Clawback\n", f" Clawback\n{standalone_head}", 1) OUT_OFFLINE.write_text(offline_html, encoding="utf-8") @@ -224,6 +227,7 @@ def build(): sw_hash.update(p.read_bytes()) idx_short = sw_hash.hexdigest()[:8] sw_txt = OUT_SW.read_text(encoding="utf-8") + assert re.search(r'const CACHE_NAME = "clawback-pwa-[^"]+";', sw_txt), "Missing CACHE_NAME in sw.js" sw_new = re.sub(r'const CACHE_NAME = "clawback-pwa-[^"]+";', f'const CACHE_NAME = "clawback-pwa-{idx_short}";', sw_txt) if sw_new != sw_txt: OUT_SW.write_text(sw_new, encoding="utf-8") @@ -242,4 +246,6 @@ def build(): if __name__ == "__main__": - build() + import sys + + build(regenerate_icons="--icons" in sys.argv[1:]) diff --git a/clawback.html b/clawback.html index cb77e18..de4dfdc 100644 --- a/clawback.html +++ b/clawback.html @@ -2,7 +2,7 @@ - + @@ -1128,6 +1128,32 @@ } } + +/* --- Mobile & safe-area polish --- */ +@media (max-width: 760px) { + input[type="text"], + input[type="number"], + input[type="url"], + input.mono, + select, + textarea { + font-size: 16px; /* prevents iOS Safari zooming the page on focus */ + } +} +.modal-card { + max-height: calc(100vh - 32px); + max-height: calc(100dvh - 32px); + overflow-y: auto; +} +.toast { + bottom: calc(22px + env(safe-area-inset-bottom, 0px)); + right: calc(20px + env(safe-area-inset-right, 0px)); +} +body { + padding-left: env(safe-area-inset-left, 0px); + padding-right: env(safe-area-inset-right, 0px); +} + @@ -1173,19 +1199,19 @@