4

Is it possible to submit some coins to some address and make them spendable after some period of time?

Like I want submit 1btc to address 1Kc24m... and make that output to be spendable after january 1st 2030.

5

Yes, you can use OP_CHECKLOCKTIMEVERIFY opcode in the locking script of the output. This opcode takes either blocks or Unix Epoch Time (seconds since 1-Jan-1970) as the parameter to lock. If the parameter is non-zero and below 500 million, it is interpreted as a block height, if it is greater than or equal to 500 million, it is interpreted as a Unix Epoch timestamp. When you would reference this UTXO at the time of spending, you need to set the transaction nLocktime equal to or great than the OP_CHECKLOCKTIMEVERIFY. The nLocktime parameter while spending should be same as what was specified in the CLTV; i.e. if the CLTV locking parameter was in blocks, it should be specified in blocks, otherwise in Unix Epoch timestamp.

Since you want it to be spendable after 1st Jan 2030, that is equivalent to timestamp of 1,893,456,000 (or 0x70dbd880). So your locking script will be concatenation of:

OP_DATA (size of CLTV_expiry): 0x04
CLTV (little endian): 0x80d8db70
OP_CLTV: 0xb1
OP_DROP: 0x75
OP_DUP: 0x76
OP_HASH160: 0xa9
OP_DATA (size of address): 0x14
Address: <address>
OP_EQUALVERIFY: 0x88
OP_CHECKSIG: 0xac

Two things to note: (1) When you are spending this transaction, the input referencing this UTXO needs to have nSequence value between 0xF0000000 to 0xFFFFFFFE. (2) Median_time (time of last 11 blocks) is used to check nLocktime when the script is evaluated which is generally about hour behind the actual time on your wall clock.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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