Skip to content
QORECHAIN
Register

Post-Quantum dApp

Casa

Sealed, post-quantum escape plans for exposed bitcoin: get your coins out before the key breaks.

Share on X

About

Millions of bitcoin sit behind public keys that are already on the blockchain: old pay-to-public-key outputs, Taproot outputs and every reused address. A large enough quantum computer could derive the private keys from those public keys, and there may be no warning before it happens. Bitcoin cannot change its signature scheme overnight, but owners can prepare to leave. Casa is a harbor for exposed bitcoin. While your key is still safe, you pre-sign one Bitcoin transaction that moves every coin to a fresh "harbor" address whose public key has never touched the chain. Casa encrypts that escape, splits the key 3-of-5 with Shamir secret sharing, and seals each share to a different keeper with ML-KEM-1024 through QoreSeal. The plan on QoreChain stores only commitments, so no single keeper, and nobody watching the chain, can open it early. Three triggers can release the escape: • Panic: the owner signs a release with ML-DSA-87, verified on chain by QoreChain's PQC precompile. • Heartbeat: if the owner stops checking in, the plan releases on its own. • Coalmine: a public elliptic-curve puzzle that acts as a cryptanalysis canary. If a rung is broken on chain, every plan bound to it triggers, with no owner online. Keepers can release the escape but never redirect it. Each input is signed with SIGHASH_SINGLE|ANYONECANPAY, so the owner's signature commits to the output and the coins can only reach the harbor. A keeper adds its own coins to pay the fee and broadcasts. Keepers post a bond. A keeper that leaks a share before a trigger can be proven guilty on chain: its bond is burned and the plan is marked compromised. Everything runs live on QoreChain testnet (qorechain-diana) and Bitcoin signet. Four end-to-end tests pass on the current v1.4 contracts: • E1, panic: sealed in the app, a 4,627-byte ML-DSA-87 panic, three shares, and 7,235,932 sats moved from the exposed address to the harbor, confirmed in signet block 333479. • E2, Coalmine: a test rung solved on chain, the plan triggered itself, and the keepers moved 7,236,808 sats with no owner online. • E3, leak: a keeper that leaked a share early was slashed and its bond burned. • E4, forgery: panics with a random ML-DSA key or an ECDSA-only signature were refused. Casa is testnet-only and not externally audited. It does not make Bitcoin post-quantum, and cancelling a plan is soft: the pre-signed transaction stays valid until the source coins are spent (casa revoke does that). What Casa does is get your coins out before the key breaks. Judges' demo (read-only, every transaction linked)

How it's made

ARCHITECTURE Casa is a pnpm TypeScript monorepo plus Foundry contracts. • contracts/ (Solidity 0.8.28, via-IR, Foundry): CasaPlans (plan state machine: SEALED → TRIGGERED → RELEASED, with CANCELLED and COMPROMISED), CasaKeepers (bonds, fees, slashing), CoalmineRung and CoalmineRegistry (curve-puzzle canaries with commit–reveal claims), PqcAuth (ML-DSA-87 verification and key-status checks through QoreChain's PQC precompiles) and ModArith. • @casa/core: plan ids and commitments, canonical bundle encoding with AES-256-GCM, Shamir 3-of-5, cross-language test vectors. • @casa/btc: exposure scanner, harbor check, SIGHASH_SINGLE|ANYONECANPAY pre-signing, keeper fee attachment, revocation builder and an Esplora client (bitcoinjs-lib). • @casa/qore: QoreChain identities, ML-DSA-87 key registration with proof of possession, ML-KEM key registration, QoreSeal share envelopes, keeper recipient cards and EVM windows. • apps/cli (casa): the owner tool. It holds the keys locally and serves a token-protected local API with a live SSE event feed. • apps/keeper (casa-keeper): a keeper daemon. It acknowledges plans after checking its envelope against the chain, watches for triggers, posts its share, attaches the Bitcoin fee and broadcasts. • apps/web: React app with Overview, Exposure, Plans, Live, Keepers, Coalmine and Settings pages. A keyless, read-only build is hosted on Vercel, with a judges' demo that replays the real E1–E4 runs. • tools/coalmine: PARI/GP curve generation, a baby-step giant-step solver and an independent vector check. Owner messages are bound as abi.encodePacked("CASA:v1:", action, chainid, verifier, id, nonce) and signed with ML-DSA-87. They are verified on chain, so a panic or cancel cannot be replayed across plans, contracts or chains. KITS QoreChain SDK (@qorechain/sdk 0.14.0, @qorechain/evm 0.14.0), @qorechain/pqc, QoreSeal (@qorechain/qoreseal 0.1.0) and QoreSign (@qorechain/qoresign 0.1.0), all TypeScript, plus viem and bitcoinjs-lib. NETWORK FEATURES • Hybrid secp256k1 + ML-DSA-87 native transactions. • ML-DSA-87 key registration with proof of possession (owner and all keepers). • QoreSeal ML-KEM-1024 envelopes and the encryption key registry, with each keeper's card checked against the on-chain registry before a plan is sealed. • EVM windows (unscoped for deployment, scoped for keeper bonding). • Solidity PQC signature check (pqcVerify precompile) for every owner action and Coalmine claim. • Solidity PQC key status (pqcKeyStatus precompile): owner actions and claims require a registered ML-DSA-87 key with proven possession. WHAT WAS HARD • Release without redirection. Keepers must be able to broadcast without being able to change where the coins go. SIGHASH_SINGLE|ANYONECANPAY lets the owner fix each output while a keeper adds a fee input and output later. • A keeper race. In the first live panic, three keepers raced to post the threshold share, which also releases the plan. All three ran out of gas because they used exact gas estimates. Keepers now add gas headroom and retry, and the run resumed on the same plan. • Slashing incentives. The first design paid part of a slashed bond to the reporter and the owner. But the owner deals every share and could fake a leak to collect. An internal review found it with a proof of concept, so bonds are now burned, and a later review closed a cancel-then-report path. • SDK edges. QoreSeal's message builder returned pre-encoded bytes that the SDK signer re-encoded as an empty message, and the RPC limits getLogs to 10,000 blocks. Both were caught live and fixed, with regression tests. • Honest canaries. The 40-bit Coalmine rung is deliberately tiny so the trigger can be shown live. Solving it is a classical benchmark, not a quantum break. The live run used a separate test rung; rungs 1 and 2 are deployed but have never been activated. TESTING AND REVIEW 83 Foundry tests (unit, fuzz, invariants, cross-language vectors), 185 TypeScript tests, and four live end-to-end runs (E1–E4) on the current v1.4 contracts, with every transaction linked in the README and the demo. AI review agents audited the contracts, the crypto and Bitcoin libraries, the CLI, keeper and API, and the web app independently, and two fresh reviewers re-checked the fixes. Every critical and high finding is fixed. This was an internal review, not an external audit. LIMITATIONS Testnet only: the PQC precompiles need a governance upgrade for mainnet. Five builder-run keepers are enough for a demo but do not prove a decentralised network. Bonds are symbolic on testnet. Bitcoin transactions are classical once broadcast. Cancel is soft until casa revoke spends the source coins. AI USAGE Built with Claude Code. Every module, what the AI did, what the human decided and where the AI was wrong are recorded in docs/AI_USAGE.md.

Timeline

CasaPost-Quantum dApp

Pushed 45 commits to main

  • 8089d87 README: point every link at usecasa.netlify.app and add the demo video · linoxbt
  • b0c6631 Netlify: serve the read-only preview API as a function at /api/* · linoxbt
  • 04b63ff Rewrite the README for submission; refresh test counts in AI_USAGE · linoxbt
  • 52b8b4a Live: name keepers from the plan (k6 is index 4), mark a confirmed broadcast as verified · linoxbt
  • c7fb120 Live E1 on v1.4 through the UI: record the run; plan view no longer calls reachable keepers offline · linoxbt

and 40 more commits

CasaPost-Quantum dApp

Earned a Ship Weeks badge.

CasaPost-Quantum dApp

Earned a Ship Weeks badge.

CasaPost-Quantum dApp

New project.

Comments and questions

  • No comments yet.