1

For my scenarios, I want freeze some funds from my wallet for some given time/block and then make that amount spendable in a single transaction.

As I understand so far, I can do it using 2 transactions with CheckLockTimeVerify (CLTV) op_code as follows:

  1. Create a transaction with an output that has the CLTV op_code to freeze some funds from the input(s).
  2. Then create another transaction which uses the above output as the input. The output of this transaction will transfer the funds back to my wallet. The nLockTime of this transaction will be set to the expire time of the previous transaction.

But is there a way to do the same as above in a single transaction? As in create a transaction whose output has CLTV op_code but is a pubkeyhash back to my wallet. This way the frozen coins become spendable without having to create another transaction?

1 Answer 1

1

When you lock coins in CLTV you still have to provide an address in the output. In that field, you can just include the address that your wallet controls. When you spend those coins, all you need to do is include the nlocktime which is higher than that specified when locking using the CLTV opcode. You need not do a second stage transaction to send the bitcoins to an address controlled by your wallet.

1
  • Thanks @ugam-kamat. Using bitcore-lib, I'm unable to attach an address to the CLTV output but I'm going to open a separate question for that issue.
    – Ali
    Jan 10, 2020 at 18:47

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.