A. since this is for testing, all the values are generated using different "websites" which you see their links below, keep in mind that for security reasons you must never do this. instead download all the respective sources and run them offline on a clean system.
B. coinb.in has a hard time with testnet apparently so some workarounds were used here. it should work fine for mainnet but you may want to test it yourself to make sure.
i am posting all these values so that you can test any tool that you may find in the future (coinb.in, using bitcoin core to sign, using Electrum or any other wallet, tool, code,...). you can double check to see if you can get the exact values. the only thing that could change is the transaction locktime as new blocks are found and block height grows.
1. creating a new key pair
1.1. we use bitaddress.org. setting it to testnet by adding ?testnet=true to the end
link
private key:
2. creating the time lock address using coinb.in
2.1. setting it to testnet by going to settings page https://coinb.in/#settings set network to bitcoin(testnet) and click submit
2.2. go to https://coinb.in/#newTimeLocked and fill in the fielts
pubkey (same as above)
time 11/28/2019 10:00
click submit.
address:
3. send coins to that address:
the faucet used (found using google) https://bitcoinfaucet.uo1.net/send.php
see history here: https://live.blockcypher.com/btc-testnet/address/2NAbY2bwun4YxmHTx7S2BbWTbKNAL1ZsdjE/
4. spend the coins (donate back to the faucet itself)
using https://coinb.in/#newTransaction (sadly the load button is disabled! probably because they don't have a testnet API to fetch UTXOs!) we have to mimic the operation ourselves...
assuming it works correctly with mainnet then all you have to do is enter your (important:) Redeem Script in the first box not your address. and click load.
if it didn't work automatically for mainnet then just follow these steps:
first entering inputs:
transaction ID: 18bea5112a442926ab171d7082ef76fbf654300f6819643699039a67ed274a1f
n (my address was the second one in txouts of above tx which means index is one) = 1
script: IMPORTANT: the same redeemscript as above not the pubkeyscript of the transaction.
amount: 0.00022
now outputs:
address: 2NGZrVvZG92qGYqzTLjCAewvPZ7JE8S8VxE (faucet address)
amount: 0.00021 (pay attention to fee)
result:
now before we sign it, there are a couple of problems with this transaction. according to BIP-65:
- locktime of this tx needs to be of the same type as the locktime of the redeemscript (time here) so we set it to a new value that is also bigger the previous one (1574922600 + 1)
- also the sequence of the input must not be max so we change that too (0xffffffff -=1)
the edited version is this:
(note that coinb.in should probably take care of all this if you use mainnet and it creates the tx for you, if it doesn't then maybe you should re-think using OP_CLV unless you find another easy to use tool)
5. signing
https://coinb.in/#sign
- enter the private key from first step in first box
- enter the edited raw tx above in second box
- and click sign
result:
6. broadcast
https://coinb.in/#broadcast
again this site doesn't have broadcast for testnet so as workaround i used Electrum with --testnet option but you could use a block explorer like https://live.blockcypher.com/btc-testnet/pushtx/ too
...and we are done:
https://live.blockcypher.com/btc-testnet/tx/5a8671cf995be0b1f7d206459549003663e265545b45023ffbda9058ebcf6742/
conclusion:
as you can see if you have some understanding of bitcoin transactions and scripts you can figure out a way to use this. it took me about 1.5 hours to create this post and i ended up writing some code myself to create and sign the transaction first and then try to make coinb.in to work!!!
so maybe it is best that you don't use this feature if it is not that important to lock coins until a proper wallet like bitcoin core or Electrum implements this feature for easy usage.