3

I would like my Bitcoin to have the extra security that a 2-of-2 multisig provides. With a single sig I am worried that if a single key gets hacked I will lose my funds. However, with a 2-of-2 multisig I am worried that if I lose either key my funds will be trapped.

How do I write a script such that my funds are locked in a 2-of-2 multisig which converts into a 1-of-2 multisig after 365 days? This way I get the best of both worlds. I have greater security for 365 days and then if I lose one of my keys I can still access my funds after 365 days.

1 Answer 1

2

To construct the script you could use Pieter Wuille's Miniscript site.

If you go to the Policy to Miniscript compiler section there is an example in Policy for a 2-of-2 multisig that turns into a 1-of-2 multisig after 90 days.

and(pk(key_user),or(99@pk(key_service),older(12960)))

You would need to adjust it for your desired example. A Policy that fits your needs would be:

and(pk(key_1),or(99@pk(key_2),older(52560)))

Once you have the Policy you can copy and paste this into the Policy to Miniscript compiler section and get the Miniscript equivalent of this Policy. The Miniscript output is:

and_v(v:pk(key_1),or_d(pk(key_2),older(52560)))

Further down you can copy and paste this Miniscript in, press Analyze and you will get the size of the resulting Script (78 bytes) as well as the actual Script:

<key_1> OP_CHECKSIGVERIFY <key_2> OP_CHECKSIG OP_IFDUP OP_NOTIF
    <50cd00> OP_CHECKSEQUENCEVERIFY
OP_ENDIF

It is worth noting that this example assumes you are more concerned with losing one particular key (key_2 in this example) and you assume will still have access to key 1. If you are just as likely to lose either key (key_1 or key_2) you would want a different script.

I recommend you try this on testnet or Signet first where coins aren't worth anything. Alternatively with a small amount of funds on mainnet that you can afford to lose. You don't want to be losing all your funds due to a mistake or a misunderstanding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.