Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ jobs:
- name: Verify committed SHA-256 checksums
run: sha256sum -c SHA256SUMS.txt

- name: Run 16-test cryptographic, consensus & adversarial security suite
- name: Run 17-test cryptographic, consensus & adversarial security suite
run: node tests/test_vault.js

- name: Verify offline clean rebuild & zero unexpected drift
run: |
python3 build.py
sha256sum -c SHA256SUMS.txt
node tests/test_vault.js
git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Test the entire lifecycle in 20 seconds using disposable keys and the real `secp
---

### 2. Whole-Wallet & Multi-Slot Vault Creator (Camera QR · microSD `.psbt` · `xpub`/`zpub`)
Sweep a single Native SegWit UTXO or your entire wallet into **1 to 5 independent Vault Slots** in a single non-RBF Funding TX—so spending a small slice never unvaults your entire reserve. Legacy `1…` / `3…` funding inputs are hard-blocked automatically to prevent `scriptSig` TXID malleability:
Sweep a single Native SegWit UTXO or your entire wallet into **1, 2 or 3 preset slot layouts (or any number of custom slots)** in a single non-RBF Funding TX—so spending a small slice never unvaults your entire reserve. Legacy `1…` / `3…` funding inputs are hard-blocked automatically to prevent `scriptSig` TXID malleability:

<p align="center">
<img src="docs/03-create-vault-setup.png" alt="Clawback Create Vault — Whole-Wallet UTXOs, Primary Key, SeedSigner Bunker, and 3-Slot Layout" width="100%">
Expand All @@ -93,7 +93,7 @@ Sweep a single Native SegWit UTXO or your entire wallet into **1 to 5 independen
---

### 3. Ephemeral Key Destruction, Mandatory Backup Gate & Miniscript Descriptors
Every slot generates a one-time ephemeral key, pre-signs the **Unvault Partial PSBT** + **3 finalized Clawback fee tiers (`15 / 50 / 200 sat/vB`)**, audits every signature, and **zeroes the ephemeral key in RAM** before unlocking the Funding PSBT. Exports checksummed **BIP-380 Output Descriptors** for Sparrow and Bitcoin Core:
Every slot generates a one-time ephemeral key, pre-signs the **Unvault Partial PSBT** + **up to 4 finalized Clawback fee tiers (`15 / 50 / 200 / 500 sat/vB`; the 500 tier is skipped on slots where it would be too large a share of the slot)**, audits every signature, and **zeroes the ephemeral key in RAM** before unlocking the Funding PSBT. Exports checksummed **BIP-380 Output Descriptors** for Sparrow and Bitcoin Core:

<p align="center">
<img src="docs/04-vault-sealed-output.png" alt="Clawback Vault Sealed — Audit Passed, Ephemeral Keys Zeroed in RAM, Mandatory Backup Gate, and Per-Slot Descriptors" width="100%">
Expand Down Expand Up @@ -159,8 +159,9 @@ Copy `clawback.html` to a USB drive, open it on an offline laptop or Tails live
```bash
git clone https://github.com/Random21m/clawback.git
cd clawback
sha256sum -c SHA256SUMS.txt # verify the committed files first
python3 build.py
sha256sum -c SHA256SUMS.txt
git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt # rebuild must be byte-identical
node tests/test_vault.js
```

Expand Down Expand Up @@ -190,7 +191,7 @@ 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:
* **16/16 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.
* **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.

---
Expand Down
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
4. **Use a completely separate key/seed for your Clawback Bunker.** Never claw back to the same seed/wallet that controls your normal spending key.
5. **Test on Signet / Testnet4 first.** Use the built-in Live Simulator and Signet mode to rehearse unvaulting and clawing back before vaulting real mainnet Bitcoin.

## Reporting a Vulnerability
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.
* **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.
6 changes: 3 additions & 3 deletions SHA256SUMS.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
3b0a5dd8d41a8abe7ca7cf35bb5ab4c5c90364bd3c5f123708e6088a687c7607 clawback.html
0fd1cd3e152bfe1808b045d2544ec35216c464df6e72439ef9e3be7457f3b99b index.html
2d4644df6a41a9afdf48dd4dc93263c2c945cb82fd2ba561ac70e4b971a5c32f sw.js
9684e3922a93f225051d290309ba54b3d7290be824e6b17a62551fc01370e135 clawback.html
fea46b1c9617b99be3e38eeef30f707697b4d485aca79d4c1d28a6558d782975 index.html
b48459f1b5730ccc3656689b5f9cb470f0a94268528d40d00058f291c0569bbf sw.js
c98a5d9112489acd8d72a90b9227883d757384ecc971b75f877becd3417fcbf9 manifest.webmanifest
10 changes: 5 additions & 5 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Clawback solves this with **Multi-Slot Vaults**: a single Funding TX splits your
1. Open **Sparrow Wallet** in Signet mode (`sparrow --network signet`) and create two test wallets:
* `Test-Primary` (Native SegWit `tb1q…`, linked to your Coldcard or software test key)
* `Test-Bunker` (separate seed, e.g., SeedSigner test seed → copy 1 fresh `tb1q…` address)
2. Fund `Test-Primary` with free Signet sats (e.g., `0.005 sBTC` / `500,000 sats`).
2. Fund `Test-Primary` with free Signet sats (e.g., `0.005` signet BTC / `500,000 sats`).
3. In Clawback **Tab 2: Create Vault**:
* Set Network = **`Signet (tb1…)`**, Delay = **`6 blocks (≈1 hr)`**, Slot Layout = **`2 Slots (25% / 75%)`**.
* Load your `Test-Primary` UTXO (via Sparrow unsigned `.psbt` or watch-only `vpub`/`tpub`), enter your `Test-Primary` spend key and `Test-Bunker` address, and click **`Build Vault & Destroy Ephemeral Key`**.
Expand Down Expand Up @@ -348,7 +348,7 @@ You have **three ways** to load funding inputs—all strictly enforce **Native S
3. Clawback automatically extracts every Native SegWit UTXO, verifies none are Legacy `1…`/`3…`, and preserves every input's exact **`BIP32_DERIVATION` (`0x06`)** fingerprint and path so Coldcard/SeedSigner will sign the final Funding PSBT natively.
* **Method B — Whole-Wallet Watch-Only `xpub` / `zpub` Scan *(Online / Own-Node Mode)*:**
1. Paste or camera-scan your watch-only `[fingerprint/84h/0h/0h]zpub…` (or `xpub…`) into the Watch-Only field and click **`Scan UTXOs`**.
2. Clawback scans receive (`m/0/0..19`) and change (`m/1/0..9`) branches via your configured Esplora endpoint, populates every spendable UTXO with its exact BIP-32 derivation path, and automatically fills a fresh unused Primary Spend Public Key and Change Address.
2. Clawback scans receive (`m/0/i`, up to index 100, stopping after 20 consecutive unused addresses) and change (`m/1/i`, up to 50, stopping after 10 consecutive unused) branches via your configured Esplora endpoint, populates every spendable UTXO with its exact BIP-32 derivation path, and automatically fills a fresh unused Primary Spend Public Key and Change Address.
* **Method C — Manual UTXO Entry:**
1. Click **`+ Add UTXO`** and enter `TXID`, `vout`, and `Amount (sats)` for each Native SegWit UTXO you wish to sweep.

Expand Down Expand Up @@ -406,7 +406,7 @@ Switch to **Tab 3: Watchtower & Panic** on your daily phone (installed as a PWA)
2. **Zero Private Key Guarantee:** `panic-only.json` contains **zero seeds, zero private keys, and zero spending authority**—only your public Vault addresses and finalized Clawback hex transactions locked exclusively to your bunker.

### 8.2 Connecting Your Own Umbrel / Start9 / Local Mempool Node (Full Privacy)
By default, Clawback queries `mempool.space` only when you click **`Check All Vaults`** (never in the background). To keep your public Vault addresses 100% private from third-party APIs:
By default, Clawback queries `mempool.space` only when you click **`Check All Vaults`** (never in the background unless you enable the opt-in **Auto: 60s** toggle). To keep your public Vault addresses 100% private from third-party APIs:
1. Enter your local Esplora / Mempool API endpoint into **Optional Custom Esplora / Self-Hosted Mempool URL**, for example:
* Umbrel Mempool app: `http://umbrel.local:3006/api`
* Start9 Mempool service: `https://<your-mempool>.local/api`
Expand Down Expand Up @@ -534,7 +534,7 @@ Clawback creates **zero proprietary formats** and **zero software lock-in**. Eve
### 12.3 Engineering FAQ

**Q: Does Clawback ever connect to the internet automatically?**
No. The single-file `clawback.html` makes zero network calls on load and has zero external CDNs or telemetry. Network requests occur *only* when you explicitly click **Scan UTXOs**, **Check All Vaults**, or **Broadcast Clawback Now**—and you can point all three exclusively at your own local Umbrel/Start9 node.
No. The single-file `clawback.html` makes zero network calls on load and has zero external CDNs or telemetry. Network requests occur *only* when you explicitly click **Scan UTXOs**, **Check All Vaults**, or **Broadcast Clawback Now** (or enable the opt-in **Auto: 60s** Watchtower toggle)—and you can point all three exclusively at your own local Umbrel/Start9 node.

**Q: What if I lose my phone with the Watchtower app on it?**
Nothing is lost and nothing is compromised. Your phone only stored watch-only public addresses and pre-signed Clawback hexes hardcoded to pay your bunker. Re-import `panic-only.json` on your new phone in 10 seconds.
Expand All @@ -547,7 +547,7 @@ Because `P2WSH` + Canonical Miniscript (`wsh(or_i(and_v(v:pk(...),older(...)),pk

**Q: How do I verify a build locally from scratch?**
```bash
python3 build.py && sha256sum -c SHA256SUMS.txt && node tests/test_vault.js
python3 build.py && git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt && node tests/test_vault.js
```
Every cryptographic check, official Bitcoin Core test vector, and theme invariant runs locally in under two seconds.

Expand Down
Loading