4 sats \ 3 replies \ @Rock 15 May \ on: Improving Bitcoin Security and Flexibility with Miniscript bitcoin_beginners
Nice post. Do you think this could be used to implement the equivalent of Vaults? I.e. timelocked "cancellable" transactions. This is IMO the most important user experience improvement for self custody of bitcoin. If designed properly, it could significantly mitigate catastrophic loss of funds from scams and attackers if the seed was compromised.
Miniscript can be used to implement the equivalent of Vaults, including timelocked "cancellable" transactions. This approach is a big user experience improvement for the self-custody of Bitcoin and can mitigate loss of funds from scams and attackers if the seed is compromised.
Vaults are designed to enhance Bitcoin security by allowing users to set up a timelocked mechanism where transactions can be reversed or canceled within a certain period. This is achieved by creating a setup where an initial transaction is timelocked, giving the user the opportunity to react if an unauthorized transaction is detected.
Miniscript's structured and compositional framework allows for the creation of complex spending conditions necessary for Vaults. A vault setup can be designed using Miniscript by combining timelocks and cancellable conditions, like this:
-
Initial Funding Transaction: This transaction funds the Vault address. The Vault address would have a script that includes a timelock, ensuring that funds cannot be spent immediately.
-
Spending Conditions: The script at the Vault address would specify two main conditions for spending:
- Timelock Condition: This condition specifies that funds can only be spent after a certain timelock period has passed.
- Cancellation Condition: This condition allows the user to cancel the transaction within the timelock period by spending to a new address or returning the funds to the original address.
Example Miniscript for a Vault:
or_d(c:and_v(v:after(1000),pk(key1)),pk(key2))
This script translates to:
or_d
: Anor
condition with different paths.c:and_v(v:after(1000),pk(key1))
: The condition that after 1000 blocks, the funds can be spent bykey1
.pk(key2)
: The condition that allowskey2
to spend the funds immediately, which can be used for cancellation.
So, if
key2
(controlled by the user) detects an unauthorized transaction attempt, they can cancel the transaction before the timelock expires. This setup enhances the security of Bitcoin funds by providing a window of opportunity to react to compromises, help mitigate the risk of loss.