Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

⏳ BCH Time Capsule

Lock Bitcoin Cash until a future date: a gift for a newborn, a birthday surprise, or savings you promise not to touch. Pick who receives it and when, lock the coins from your wallet, and share a link with a live countdown. After the unlock date, anyone can press Release, and the coins can only go to the recipient.

Built for BCH BLAZE 2026 (Mainnet Track).

20-second demo: create, connect, countdown, release

No wallet? Try it anyway. These are real capsules on testnet, made and released with a real wallet: a locked one and one that was already released (release tx 8c633351…).

Create Connect (WizardConnect) Countdown Released

How it works

Each capsule is a CashScript covenant (contracts/TimeCapsule.cash) parameterised by the recipient's address and the unlock time. Its address is derived from those two values, so a capsule needs no server or database. The share link carries the parameters, and anyone can recompute the address and read its balance.

The covenant enforces, on-chain:

Rule Why
tx.time >= unlockTime (CLTV) Nobody can move the coins early, not even the giver.
exactly 1 input and 1 output No room to bolt on inputs/outputs that siphon value.
the output pays the recipient's P2PKH address Coins can only ever go to the recipient.
output value ≥ input − 2,000 sats A third party pressing Release can't burn the gift as miner fees.
CashTokens category, amount and NFT commitment are preserved Any tokens in the capsule travel with it.

Because the destination and fee are pinned, release needs no signature. The app builds the transaction itself and broadcasts it, so the recipient doesn't even need to be online or own the dApp.

Deposits are a normal payment from the user's wallet to the capsule address, signed and broadcast through WizardConnect (Selene, Paytaca and Cashonize support it). The app derives the wallet's addresses from the xpubs shared during pairing, selects coins, and builds the transaction with CashScript's WalletConnect helpers.

Run it

npm install
npm run dev        # http://localhost:5173
npm test           # covenant tests on CashScript's mock network (VM-accurate)
npm run build      # static site in dist/

Add ?network=chipnet to the URL to use testnet instead of mainnet.

Notes

  • Release timing: Bitcoin Cash checks time locks against the median time of the last 11 blocks, which runs about one hour behind the clock. Release becomes possible roughly an hour after the unlock time; the app explains this if it's pressed too early.
  • Multiple deposits: each deposit is a separate UTXO and is released in its own transaction (a covenant rule that stops fee theft). The app releases them all with one click.
  • Recipient address: must be a regular wallet address (P2PKH). Both q… and token-aware z… forms work.

Project layout

contracts/TimeCapsule.cash   the covenant
src/contract/TimeCapsule.json compiled artifact (npm run compile)
src/lib/capsule.ts           contract, release tx, share links
src/lib/wallet.ts            WizardConnect deposit: xpub scan, coin selection, sign + broadcast
src/lib/network.ts           Electrum server failover, chain clock (median time past)
src/lib/activity.ts          capsule history: deposits and release
src/App.tsx                  UI
test/                        covenant, deposit (fake wallet), activity and network tests
scripts/                     screenshot + demo GIF generators

Screenshots and demo GIF

docs/screenshots/ holds slide-ready PNGs (2560×1600, plus 1170×2532 mobile). To regenerate them and docs/demo.gif after a UI change, with the dev server running on port 5179:

node scripts/shoot.mjs && python scripts/make_gif.py

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages