Skip to content
Random21mPublic

About

Time-delayed Bitcoin vaults with pre-signed 4-tier emergency clawback (P2WSH + BIP-68 CSV + Miniscript + BBQr) — zero soft forks, zero custodians, zero stored keys.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Clawback Red Crab Logo

Clawback

Time-Delayed Bitcoin Vaults with Pre-Signed Emergency Clawback
Give your existing hardware wallet a trustless 1-hour to 180-day "Undo Button" on Bitcoin today — zero soft forks, zero custodians, zero stored private keys.

→ Open Clawback Live  ·  ↓ Download Offline HTML  ·  Read the Complete 12-Chapter Tutorial  ·  Verify SHA-256  ·  Bitcoin Timestamp (.ots)

SegWit v0 P2WSH · BIP-68 CSV · BIP-174 PSBT · BIP-380 Miniscript · BBQr Airgap · OpenTimestamps · Zero Custody

Timestamped in Bitcoin (OpenTimestamps): the v1.0 release checksums at commit 69b9035 (release-proofs/v1.0/SHA256SUMS.txt, SHA-256 e44e7a8dd2fe70567b7151e616fb6fe5c63cc70ec2bd29820e8b922523131fc1) are cryptographically anchored in Bitcoin Block 978,244 (30 November 2026 at 21:39:19 UTC, Merkle root 76d264f2…a09222c9). The complete proof is release-proofs/v1.0/SHA256SUMS.txt.ots — verify with cd release-proofs/v1.0 && ots verify SHA256SUMS.txt.ots or online at opentimestamps.org. The root SHA256SUMS.txt tracks the current build; its proof, SHA256SUMS.txt.ots, was submitted to the OpenTimestamps calendars on 1 December 2026 and is pending until a Bitcoin block confirms it — run ots upgrade SHA256SUMS.txt.ots once it has, and commit the upgraded file. It covers only the checksum file as of that submission, so a later rebuild needs a new stamp.

Clawback Live Attack & Clawback Sandbox — Unauthorized Unvault Detected with 7-Day Quarantine Countdown and 4-Tier Emergency Clawback Trigger


Why Clawback Exists: The Lesson of the July 2026 Coldcard Incident

For seventeen years, Bitcoin self-custody operated under one brutal, unforgiving rule: if an attacker obtains your signing key, your Bitcoin is gone in a single block with no undo.

In July–August 2026, that rule hit cold storage harder than any event in Bitcoin history. A firmware build error introduced in March 2021 caused Coldcard devices to silently fall back from hardware RNG to MicroPython's predictable Yasmarang software PRNG—collapsing seed strength to roughly 40 bits on older models (Mk2/Mk3) and ≈72 bits on newer models (Mk4/Mk5/Q). Fifteen independent security reviews missed it for over five years. Starting July 30, 2026, attackers brute-forced the reduced keyspace offline and systematically drained an estimated 1,816 BTC (≈$116 million) across 5,000+ addresses without ever touching a single victim's physical device.

Firmware updates could not rescue already-generated seeds. Standard single-sig cold storage gave victims zero reaction time.

What Changes When Your Wallet Is Armored With Clawback

Clawback is not a wallet and never asks for your seed phrase. It is a discreet, offline-first Bitcoin consensus armor layer that wraps around your existing hardware wallet (Coldcard, Jade, Trezor, Ledger, Sparrow) and pairs it with an independent offsite bunker (e.g., a dice-rolled SeedSigner or separate-vendor cold seed):

  1. Layer 1 — Remote Brute-Force Blocked Completely: Your vaulted coins sit in a 2-of-2 P2WSH Vault (Your Primary Wallet Key + Destroyed Ephemeral Key). Because the ephemeral key is permanently zeroed in RAM before funding, an attacker who brute-forces or steals only your hardware wallet key still cannot move a single sat without your pre-signed Unvault TX.
  2. Layer 2 — Mandatory Quarantine Freeze (Even Under Full Compromise): Even if an attacker steals both your physical hardware wallet and your Vault Package, broadcasting Unvault TX is mathematically forced by Bitcoin consensus (OP_CHECKSEQUENCEVERIFY) into a 7-day (1,008-block) Quarantine Script. Even with your device and PIN in hand, the attacker is frozen out for 1,008 blocks.
  3. Layer 3 — 1-Tap Emergency Clawback to Your Bunker: Your Watchtower alerts you the moment an unvault hits the mempool. You tap Broadcast Clawback from your phone (no hardware wallet required in the crisis!)—choosing 15 / 50 / 200 sat/vB—and rip 100% of your Bitcoin straight into your independent offsite bunker in the next block.
Threat Scenario Standard Single Hardware Wallet 2-of-3 Hardware Multisig Clawback Time-Delayed Vault
Remote RNG / Entropy Compromise (July 2026 Coldcard class) Instant total drain in 1 block Protected only if ≥2 vendors/RNGs used 0 sats moved (2-of-2 requires pre-signed Unvault TX) + 7-day clawback to independent bunker
Stolen Daily Hardware Wallet + PIN Instant total drain Safe if 2 other keys offsite Frozen for 7 days by Bitcoin consensus → 1-tap Clawback to offsite bunker
Malware / Compromised Signing PC Vulnerable to blind-sign drain Vulnerable if 2 keys compromised Attacker trapped in 7-day quarantine → instant Clawback
Panic Button / Watchtower Phone Stolen N/A N/A Zero risk — pre-signed Clawback TX is cryptographically locked to only pay your bunker address
Requires Soft Fork (OP_CTV / OP_VAULT)? No No No — 100% standard Bitcoin mainnet today
Custodian / Subscription / Lock-In? None Optional coordinator Zero — standard P2WSH + BIP-380 Miniscript + raw hex

Visual Tour

1. Live Attack & Clawback Sandbox (Real Cryptography, Zero Risk)

Test the entire lifecycle in 20 seconds using disposable keys and the real secp256k1 + P2WSH CSV engine. Inspect the live Canonical Miniscript ASM, TXIDs, and finalized raw Clawback hex:

Clawback Completed — Funds Swept to SeedSigner Bunker with Canonical Miniscript ASM and Raw Hex


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, 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:

Clawback Create Vault — Whole-Wallet UTXOs, Primary Key, SeedSigner Bunker, and 3-Slot Layout


3. Ephemeral Key Destruction, Mandatory Backup Gate & Miniscript Descriptors

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:

Clawback Vault Sealed — Audit Passed, Ephemeral Keys Zeroed in RAM, Mandatory Backup Gate, and Per-Slot Descriptors


4. Airgapped Coldcard Q & SeedSigner Animated BBQr QR

Scan inputs with your camera (jsQR + multi-frame BBQr reassembly) and beam Funding PSBTs, Unvault Partial PSBTs, and offline Clawback TXs directly back as animated BBQr QR codes:

Clawback Animated BBQr QR Modal for Airgapped Coldcard Q and SeedSigner Signing


5. Watchtower & 1-Tap Panic Monitor (Desktop & Discreet Mobile PWA)

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 Tiered Clawback Controls

Clawback Discreet Dark-Slate Mobile PWA — Red Crab Attack Alert and Quarantine Countdown


6. Independent Offline Cryptographic Auditor & Post-Quarantine CSV Spend Builder

Audit any Vault Package completely offline (re-verifying every script hash, BIP-143 ECDSA signature, Native SegWit input, non-RBF sequence, and bunker destination) and build ready-to-sign BIP-68 CSV Spend PSBTs (nVersion=2, nSequence=csvBlocks) once your quarantine timer completes:

Clawback Independent Offline Vault Auditor and Post-Quarantine CSV Spend PSBT Builder


Quick Start: 3 Ways to Run Clawback

Option 1 — Run Live in Your Browser (Instant Sandbox & Watchtower)

  1. Open https://random21m.github.io/clawback/ (available once published to GitHub Pages; locally run python3 -m http.server 8091 and open http://127.0.0.1:8091/).
  2. Try Tab 1: Live Simulator immediately—zero wallet needed.
  3. Tap Add to Home Screen (iOS/Android) or Install App (Desktop) for a discreet Red Crab PWA icon on your home screen.

Option 2 — Single-File Airgapped Offline Download (Recommended for Mainnet Vault Creation)

clawback.html is a single, completely self-contained ≈539 KB HTML file with all cryptography, PSBT codecs, QR encoder/decoder, and UI inlined—zero external CDNs, zero telemetry.

# 1. Download clawback.html and the current build checksums, then verify integrity
curl -LO https://raw.githubusercontent.com/Random21m/clawback/main/clawback.html
curl -LO https://raw.githubusercontent.com/Random21m/clawback/main/SHA256SUMS.txt
sha256sum -c --ignore-missing SHA256SUMS.txt

# 2. (Optional) Verify the v1.0 release's Bitcoin timestamp proof, kept in its own folder
mkdir -p v1.0 && cd v1.0
curl -LO https://raw.githubusercontent.com/Random21m/clawback/main/release-proofs/v1.0/SHA256SUMS.txt
curl -LO https://raw.githubusercontent.com/Random21m/clawback/main/release-proofs/v1.0/SHA256SUMS.txt.ots
ots verify SHA256SUMS.txt.ots   # (or verify online at https://opentimestamps.org)

Copy clawback.html to a USB drive, open it on an offline laptop or Tails live session, create your Vault Package, and reboot to guarantee RAM is wiped clean.

Option 3 — Build & Verify From Source

git clone https://github.com/Random21m/clawback.git
cd clawback
sha256sum -c SHA256SUMS.txt   # verify the committed files first
python3 build.py
git diff --exit-code clawback.html index.html sw.js SHA256SUMS.txt   # rebuild must be byte-identical
node tests/test_vault.js

Cryptographic Specification at a Glance

[Primary Wallet Native SegWit UTXOs (bc1q / bc1p)]
        │
        ▼  Funding TX (nVersion=2, Non-RBF 0xffffffff, BIP-174 PSBT w/ BIP-32 origins)
[2-of-2 P2WSH Vault Slot]
   wsh(sortedmulti(2, USER_KEY, EPHEM_KEY))
   * EPHEM_KEY is permanently zeroed in RAM BEFORE Funding TX is broadcast *
        │
        ▼  Unvault TX (Pre-signed EPHEM half + USER signature → BIP-174 Partial PSBT)
[Canonical Miniscript Quarantine Script (P2WSH)]
   wsh(or_i(and_v(v:pk(USER_KEY),older(CSV)),pk(EPHEM_KEY)))
   OP_IF <userPub> OP_CHECKSIGVERIFY <csvBlocks> OP_CHECKSEQUENCEVERIFY
   OP_ELSE <ephemPub> OP_CHECKSIG OP_ENDIF
        │
        ├─── Path 1 (OP_IF · After CSV blocks) ────► Normal Spend (Signed by Primary Wallet)
        │
        └─── Path 2 (OP_ELSE · 0-block instant) ───► Pre-Signed Clawback TX (15 / 50 / 200 / 500 sat/vB)
                                                     Hardcoded ONLY → Offsite Bunker Address

Independent Verification & Rehearsals

Clawback's transaction engine has been verified against both our strict consensus suite and independent third-party Bitcoin libraries:

  • 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.

Complete Documentation

  • TUTORIAL.md — The Complete 12-Chapter Engineering & Operations Manual: Deep dive into the July 2026 Coldcard incident, full script execution traces, airgapped Tails setup, step-by-step Signet rehearsal, Coldcard + SeedSigner production setup, Umbrel/Start9 Watchtower configuration, 60-second Emergency Clawback Playbook, Sparrow/Bitcoin Core disaster recovery, and full threat model matrix.
  • SECURITY.md — Core operational invariants and safety rules.
  • SHA256SUMS.txt & SHA256SUMS.txt.ots — Reproducible build hashes + their (pending) OpenTimestamps proof. release-proofs/v1.0/ — the v1.0 checksums with their Bitcoin OpenTimestamps proof.

Support

Clawback is free, open source, and zero-tracking. If it helps protect your stack, a tip over Lightning helps keep cypherpunk Bitcoin security tools coming:

Lightning tip QR code for Clawback

npub1t5nvfnlmegsqkqegcpnyek4qf4fc2f2gx2t4lm88h2kq22plpmxqdhgpa9@npub.cash

(An npub.cash Lightning address: scan the QR code or paste the address into any Lightning wallet — also built right into the in-app Support button.)

You can also support Clawback by picking up a BitBox02 hardware wallet (referral link) — Swiss-made, open-source Bitcoin hardware security (and a great vendor-independent pairing for your Clawback Bunker).


License

MIT. Use it, fork it, air-gap it, run your own.
Includes bundled offline QR decoding via jsQR (Apache-2.0 License).

About

Time-delayed Bitcoin vaults with pre-signed 4-tier emergency clawback (P2WSH + BIP-68 CSV + Miniscript + BBQr) — zero soft forks, zero custodians, zero stored keys.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages