Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Chris! on September 27, 2019, 02:50:52 AM



Title: Easy and reliable timelock tx?
Post by: Chris! on September 27, 2019, 02:50:52 AM
The title says it all! Is there an easy way for someone to timelock a transaction yet? By easy I mean a GUI rather than command line, and by reliable I mean it works every time no matter what, not relying on some third party.


Title: Re: Easy and reliable timelock tx?
Post by: TryNinja on September 27, 2019, 03:21:14 AM
Take a look at Coinb.in's time locked address feature. It is open source, so you can run it locally and in an offline environment.

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 (http://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 (http://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!


Title: Re: Easy and reliable timelock tx?
Post by: pooya87 on September 27, 2019, 04:55:10 AM
usually things like this are considered advanced and since they don't have that much demand wallets either don't implement it at all (even through their CLI) or only have it accessible through the command line interface. but if you think it is needed (like seeing a lot of timelocked txs on the blockchain every day) then open an issue in your favorite wallet and ask them to add the functionality.
otherwise you only have less popular and sometimes less safe tools like coinb.in

Quote
5. Submit and save the Redeem Script (don't lose that or you won't be able to spend your coins in the future);
as long as you own your private key and remember the "locktime" you used, you can always reproduce the redeem script easily. the script is a pretty easy one too:
Code:
<expiry time> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
even if you forget the "expiry time", if you knew the ball park you could easily brute force it in a short time.

ps. you can also always avoid using P2SH but coinb.in doesn't have that option.


Title: Re: Easy and reliable timelock tx?
Post by: nc50lc on September 27, 2019, 05:21:05 AM
The most finished PR to Electrum that I know is from bauerj (https://github.com/spesmilo/electrum/pull/2405) but it wasn't merged due to the some issues (IMO, very minor).

You can use the same wallet above (coinb.in) to create a transaction with timelock,
After setting all the inputs, outputs and the amounts in the https://coinb.in/#newTransaction;
just click "advanced option" and find "locktime", put a future block height when you want to broadcast the TX.
Verify then Sign the Tx.

If the user prefer a "timelocked address" created using OP_CLTV, follow post#2.
All aren't an "easy way".

TL:DR: None.


Title: Re: Easy and reliable timelock tx?
Post by: Chris! on September 28, 2019, 01:45:41 AM
Damn. I was trying to prove a forced HODL but it sounds way too risky right now. Hopefully this is something that us plebs can do in the future. Thanks guys.


Title: Re: Easy and reliable timelock tx?
Post by: sdp on October 25, 2019, 08:26:39 PM
It seems to me this is something the recipient software should prepare for by creating an address and keep the linked redeem script for ever for that address.  As coins go there, they are locked.  The sender software wont be able to derive the redeem script from the address but I think the otherway around.