Description
How to make sure that a friend or family member can access your BTC if Something Bad happens to you... (trustlessly)?
Send your BTC to a non-standard output with a locking script like:
OP_IF
${bitcoinJsLib.script.number.encode(lockTime).toString('hex')}
OP_CHECKLOCKTIMEVERIFY
OP_DROP
${cltvSpender.publicKey.toString('hex')}
OP_CHECKSIG
OP_ELSE
${nonCltvSpender.publicKey.toString('hex')}
OP_CHECKSIG
OP_ENDIF
Sender is nonCltvSpender
, i.e. can spend anytime with redeem script OP_TRUE.
Beneficiary is cltvSpender
, i.e. can spend anytime after OP_CHECKLOCKTIMEVERIFY elapses with redeem script OP_FALSE.
Required Wallet Sugar
(1) Wallet will lookup beneficiaries by registered email (hash lookup in DSC) - note: DSC will need to be extended to expose accounts' BTC pubKeys (also can be a nice viral referral flow - beneficiary refers new wallet signups by email prompt...)
(2) Wallet will prompt Benefactors to "roll over" his non-std outputs periodcally to reset OP_CHECKLOCKTIMEVERIFY interval. If and when that fails to happen, output will become spendable by Beneficiary.
WIP... see wallet-btc-p2sh.js (and "DMS" comments in-line, various).