I just want to make sure I am writing the script correctly, and was hoping somebody could point out my errors or let me know it's correct. I have 2 keys, and I want to require both keys' signatures or wait 2 weeks after inclusion in a block and require 1 signature.
The keys are:
020dd847d245216d27fad46c99ea490b8b9dbae87e144fc1f0c9427b041e4acf90
0346cbb9b74d786560a7e69a1013ddb6af6931d939f9dbba8311aab55de4fb772f
My understanding of the RLT BIP is that 2 weeks would translate to 0x40093a. So the script I came up with is:
OP_IF
0x40093a OP_CHECKSEQUENCEVERIFY OP_DROP
1
OP_ELSE
2
OP_ENDIF
020dd847d245216d27fad46c99ea490b8b9dbae87e144fc1f0c9427b041e4acf90
0346cbb9b74d786560a7e69a1013ddb6af6931d939f9dbba8311aab55de4fb772f
2
OP_CHECKMULTISIG
which I believe translates into the redeem script hex of:
634e3a094000b2755167526821020dd847d245216d27fad46c99ea490b8b9dbae87e144fc1f0c9427b041e4acf90210346cbb9b74d786560a7e69a1013ddb6af6931d939f9dbba8311aab55de4fb772f52ae
for the address 3B6X5FyVdm3qS8J2CNbX2n8M2JyzXhQw8L.
Alternatively, I changed the relative locktime to be 2016 blocks instead of two weeks, for a redeem script of:
634de007b2755167526821020dd847d245216d27fad46c99ea490b8b9dbae87e144fc1f0c9427b041e4acf90210346cbb9b74d786560a7e69a1013ddb6af6931d939f9dbba8311aab55de4fb772f52ae
and the address 3DDPMrpPeL81WEb4u8cVgRAGZyGanVCVVp.
Are those redeem scripts correct? And to spend from them, I would need to set the sequence of the input to match what's in the redeem script (but filled to all 4 bytes in the case of the 2016 block example).. is that correct? And the scriptsig would look like this:
or alternatively
Do I have everything correct?
Please don't send money for me to test. (Not that anybody was going to.) Those keys are NOT the actual keys involved! I made them up for the purposes of posting here.
Thanks for the help!
Edit: Random thought... Could I remove the OP_DROP and the 1 from the OP_IF and use the OP_TRUE stack item produced by OP_CHECKSEQUENCEVERIFY as the OP_1 for the multisig m-keys-required?