0

With a multisig wallet, several public keys are needed to spend an amount. But how to perform the reverse with time ?

I’m talking about this case where Alice performs a transaction where the output is sent to both Bob and Victor. With one point : Bob will be able to spend the transaction output immediately while Victor will only be able to do it after waiting some time if Bob didn’t spend it before Victor is allowed to do so.
It doesn’t matter if Bob is still able to spend the output after Victor can. However Alice can’t get the public keys from Bob and Victor but only their address.

I’m thinking about something using OP_CHECKLOCKTIMEVERIFY or CHECKSEQUENCEVERIFY or nLockTime but I definitely fail to think about what the whole Opcode sequence might looks like.

1 Answer 1

2

The following scriptPubKey describes the desired contract:

OP_IF
    OP_DUP OP_HASH160 <Bob's pubKeyHash>
OP_ELSE
    <now+30 days> OP_CHECKLOCKTIMEVERIFY OP_DROP
    OP_DUP OP_HASH160 <Victor's pubKeyHash>
OP_ENDIF
OP_EQUALVERIFY OP_CHECKSIG

Bob can spend the output using the scriptSig <Bob's signature> <Bob's pubKey> OP_TRUE
Victor can spend the output after 30 days using the scriptSig <Victor's signature> <Victor's pubKey> OP_FALSE.

13
  • bitcoin.sipa.be/miniscript/miniscript.html. Wouldn’t it rather be pastebin.com/pzQKN0ud ? Commented Mar 28, 2019 at 2:38
  • no I don't think you need that 1 and 2 there. In my version, Bob could pay by with <signature> <pubkey bob> 1 , and victor with <signature> <pubkey victor> 0 , but I don't doubt there is a better way
    – Fraggle
    Commented Mar 28, 2019 at 2:45
  • This is after github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#Escrow but which is for MultiSig in the case of Victor. Commented Mar 28, 2019 at 2:47
  • 1
    You don't need 1 and 2. Those are only required for OP_CHECKMULTISIG. This is just an OP_CHECKSIG which does not need a threshold number.
    – Ava Chow
    Commented Mar 28, 2019 at 2:50
  • Yeah you don't need multi-sig right. Just bob can spend funds at any time, victor can spend funds after some time as long as bob hasn't already spent them. So no 1,2, multi-sig thing. Just Bob can spend, or Victor can spend after a time has past.
    – Fraggle
    Commented Mar 28, 2019 at 2:51

Your Answer

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

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