Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Sanglotslongs on August 23, 2021, 08:42:41 PM



Title: Bitcoin lock time function
Post by: Sanglotslongs on August 23, 2021, 08:42:41 PM
Hello,

I know there is a function to make your bitcoins unspendable until block X.

Is this knowledge (block number) public ?

If yes do you have example of addresses that have fund locked that are known ?

I guess it's a pretty unusual function to use.


Title: Re: Bitcoin lock time function
Post by: DannyHamilton on August 23, 2021, 09:30:17 PM
Hello,

I know there is a function to make your bitcoins unspendable until block X.

Is this knowledge (block number) public ?

Yes.

If yes do you have example of addresses that have fund locked that are known ?

No, I don't have an example.  Hopefully someone else with that information will stop by shortly and reply with a link to a block explorer with such a transaction ( or at least with the transactionID)


Title: Re: Bitcoin lock time function
Post by: Upgrade00 on August 23, 2021, 09:35:04 PM
I know there is a function to make your bitcoins unspendable until block X.
Yes, it's possible.
One option is to create a time locked transaction (https://en.bitcoin.it/wiki/Timelock); In this condition, a transaction would not be available for verification or confirmation untilt the blockheight indicated in the transaction information. This means it would be unspendable by the receiving address until the specified time. This of course comes with its pros and cons;

• The transaction can be cancelled by the sending address,
• There can be a change to the Bitcoin network in the distant future that will render the transaction invalid.


Title: Re: Bitcoin lock time function
Post by: HCP on August 24, 2021, 01:17:05 AM
Yes, it's possible.
One option is to create a time locked transaction (https://en.bitcoin.it/wiki/Timelock); In this condition, a transaction would not be available for verification or confirmation untilt the blockheight indicated in the transaction information. This means it would be unspendable by the receiving address until the specified time. This of course comes with its pros and cons;

• The transaction can be cancelled by the sending address,
• There can be a change to the Bitcoin network in the distant future that will render the transaction invalid.
That's not quite what the OP appears to be asking... This timelock (using nLocktime), actually makes the spending transaction invalid until a certain time.

It's not really locking bitcoins, as they can still be spent in other transactions.


To lock bitcoins... you would need to use the CheckLockTimeVerify (CLTV) (https://en.bitcoin.it/wiki/Timelock#CheckLockTimeVerify) or CheckSequenceVerify (CSV) (https://en.bitcoin.it/wiki/Timelock#CheckSequenceVerify) opcodes to lock the UTXO themselves.


For an example of CLTV in action... I posted this example in another thread (it uses coinb.in and testnet): https://bitcointalk.org/index.php?topic=5287093.msg55533007#msg55533007


Title: Re: Bitcoin lock time function
Post by: nc50lc on August 24, 2021, 03:23:04 AM
Is this knowledge (block number) public ?
You mean the "is the block number or time that you've set in the script, public?" right?

No as long as the address isn't re-used (there's no reason to reuse it after the lock time anyways).
The first time you funded the address where your bitcoins will be locked, it will look like just another 'send-to' P2SH or P2WSH transaction.
The txn may be available in the blockchain but they can't see its "redeem script" so they wont be able to see the block or time that you've set.


Title: Re: Bitcoin lock time function
Post by: DannyHamilton on August 24, 2021, 03:45:43 AM
The txn may be available in the blockchain but they can't see its "redeem script" so they wont be able to see the block or time that you've set.

However, when the UTXO is eventually spent, the "redeem script" will be a part of the Txin-script and will therefore be publically available.


Title: Re: Bitcoin lock time function
Post by: nc50lc on August 24, 2021, 04:02:35 AM
The txn may be available in the blockchain but they can't see its "redeem script" so they wont be able to see the block or time that you've set.
However, when the UTXO is eventually spent, the "redeem script" will be a part of the Txin-script and will therefore be publically available.
Yes indeed, that's why I mentioned "as long as the address isn't re-used".
But in this particular use-case, there's no way that the 'unspent transaction output' can be spent before the lock time passed anyways.
So IMO it's safe to say, no.