Post
Topic
Board Development & Technical Discussion
Re: How does nLockTime work? (ELI5)
by
Abiky
on 20/03/2020, 22:09:09 UTC
There is an easy way to do that, which I already explained in another thread:

(not with Core, though)

You can use Coinbin to do that. I had one a few months ago and it's quite easy to create/spend your coins after the chosen period.

To create the Time Locked Address:
1. Go to Coinb.in;
2. New -> Time Locked Address.
3. Enter your address public key (the one you require to sign the transaction and be able to spend the coins);
4. Enter the date-time or blockheight you want to release the coins.
5. Submit and save the Redeem Script (don't lose that or you won't be able to spend your coins in the future);
6. Send the coins you want to keep locked to the Address generated.

After the chosen period, you will be able to spend your coins.
1. Go to Coinb.in;
2. New -> Transaction;
3. Paste your Redeem Script and click Load (it's going to show every input available to be spent);
4. Paste the address you want to send the coins to at the "Address" field and the amount in the "Amount" field. The remaining funds will be used as fee. E.g: If your address has 0.015BTC, you can put 0.014BTC in the "Amount" field and the fee will be 0.001BTC (0.015 - 0.014);
5. Submit and copy the raw transaction;
6. Go to the "Sign" tab (at Coinb.in);
7. Paste the private key from the address you choose when creating the Time Locked Address.
8. Paste the raw transaction you just created.
9. Submit, copy the signed transaction and push it to the network (you can do it in the Broadcast tab).
10. Transaction sent!

A well-detailed explanation. Thanks a bunch for this, mate. This is so much easier than using the command line to interact with time-locked transactions. I'd wish to know how to do it on the Bitcoin Core wallet too (bitcoind or bitcoin-qt) so that I could use it at a later time in case the Coinb.in website goes down. The "nLockTime" feature is certainly useful for unlocking funds after Xmas, a birthday, or even after death. I became curious about it the moment I saw "PaperSafe" with some BTC certificates which had a locked address with funds on it. It was then, I've decided to look more thoroughly into "nLockTime" to use it for my own benefit.

Anyhow, if you or anyone else knows how to do this also in Bitcoin Core, I'd greatly appreciate some guidance. In the meantime, I'll use this service for creating time-locked transactions for BTC. It's a really useful tool. Smiley



It was discussed here before you can check it from here How to send a transaction at a specific time?

You can follow the guide from posted above with coinb.in until step 5 and then sign the transaction in the Bitcoin core wallet.

To sign the generated hex from coinb.in to Bitcoin core you can use this command to console.

Code:
signrawtransaction "hexstring"
Hexstring should be the hex generated from coinb.in

Thanks for this great info! I appreciate your help. I can see that it's easy to create time-locked transactions using this online tool. I would've wished to do everything in Bitcoin Core itself, but I guess that it's somewhat hard to achieve. I'll stick with the Coinb.in service in the meantime until I get to know how to perform these kind of transactions on Bitcoin's native wallet itself. Wink