Pages:
Author

Topic: Is there a service that lets you lock your Bitcoin for 24-48 hours etc.? - page 2. (Read 456 times)

legendary
Activity: 3472
Merit: 10611
2 things to have in mind
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:
Code:
cVVeRq1oaneL6ELYBXZfkuT3YJSeFB7g8rpRexYKKNDQhqPxkuHT
public key:
Code:
0387CBC334A467FB592BD6E467EA21D34B7226BE38841469EF83424D8BE2B76E5A

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:
Code:
2NAbY2bwun4YxmHTx7S2BbWTbKNAL1ZsdjE
redeem script:
Code:
046869df5db175210387cbc334a467fb592bd6e467ea21d34b7226be38841469ef83424d8be2b76e5aac

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:
Code:
0100000001692fe9564b4b17d580bb797b5ad5e1ccccffc7fb6b2f5aae4518744af1a1cf4b0100000017a914cd145d38914f7cdd4ae2f6df4b50f9976a42778e87ffffffff01583e0f00000000001976a914344a0f48ca150ec2b903817660b9b68b13a6702688ac00000000

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:
Code:
01000000011f4a27ed679a0399366419680f3054f6fb76ef82701d17ab2629442a11a5be180100000017a914be51843ee8b9fd148987833e53342466be38100387feffffff01085200000000000017a914ffd0dbb44402d5f8f12d9ba5b484a2c1bb47da42876969df5d

(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:
Code:
01000000011f4a27ed679a0399366419680f3054f6fb76ef82701d17ab2629442a11a5be180100000073473044022066c49835065ce39c59e60335b02c22250c06388040d9f2d3203e73d4935edb5702200f31da26d187ee19c3521f903b7abd55dbea83d276852e4ef7d2c3a5b5279328012a046869df5db175210387cbc334a467fb592bd6e467ea21d34b7226be38841469ef83424d8be2b76e5aacfeffffff01085200000000000017a914ffd0dbb44402d5f8f12d9ba5b484a2c1bb47da42876969df5d

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.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
There must be a problem with the unsigned raw tx or the provided prv key if you're having problem with signing.
Which private key am I supposed to provide in the SIGN page of Coin.in ?
Or what problem could be with the unsigned raw tx?
Remember the public key that you've pasted when you created the time locked address?
You need to provide the private key of that public key to be able to sign the raw transaction.

For the possible problem with the unsigned TX, it could be something in the coinb.in "transaction" page.
It's hard to tell without the raw tx.

edit: the signing part proved to be a lot harder than i thought. coinb.in doesn't even sign the given transaction!!! currently looking for an alternative way. i will publish the whole thing if i succeed.
Weird, it worked at my end (it's currently accepted by blockcypher).
I'm just waiting for the timelock to expire in order to re-broadcast it to other block explorers.
sr. member
Activity: 1877
Merit: 389
There must be a problem with the unsigned raw tx or the provided prv key if you're having problem with signing.

Which private key am I supposed to provide in the SIGN page of Coin.in ?
Or what problem could be with the unsigned raw tx?
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-edit-
This thread mentioned that it uses UTC for the date/time selection UI.
That explains why it still wasn't propagated yet (it's 8AM UTC while I set the timelock to 3:20PM).
At least we now know that the script is working Wink

Okay, so right now it's 08:32am UTC - so is this the reason why I'm getting an error when trying to sign the transaction? So basically that proves that the "lock" is working properly?
No, there will be no problem with the creation and signing of the RAW transaction regarding the timelock,
If it's still not past the timelock, you won't be able to broadcast it to most nodes (blockcypher's nodes will accept it though).

There must be a problem with the unsigned raw tx or the provided prv key if you're having problem with signing.
sr. member
Activity: 1877
Merit: 389
-edit-
This thread mentioned that it uses UTC for the date/time selection UI.
That explains why it still wasn't propagated yet (it's 8AM UTC while I set the timelock to 3:20PM).
At least we now know that the script is working Wink

Okay, so right now it's 08:32am UTC - so is this the reason why I'm getting an error when trying to sign the transaction? So basically that proves that the "lock" is working properly?

Need to wait 1 hour to see if it really works or not.

Can you please advise, when you click on the SIGN page in Coinb.in - which Private Key do you need to place in the Private Key field? Is it the private key of your Bitcoin address from Electrum for instance?
legendary
Activity: 3472
Merit: 10611
Any idea how to resolve this?

no, but give me some time to create one testing address testnet and will post all the steps here maybe that way you can see which step was the problem.

edit: the signing part proved to be a lot harder than i thought. coinb.in doesn't even sign the given transaction!!! currently looking for an alternative way. i will publish the whole thing if i succeed.
sr. member
Activity: 1877
Merit: 389
go to https://coinb.in/#newTransaction
in first textbox enter the redeem script and click load, the site automatically converts it to the address and fetches the Unspent Transaction Outputs. the rest of the boxes should be clear to set the inputs and outputs. then you just have to take that raw tx and sign it with their sign page https://coinb.in/#sign

When I'm trying to sign the transaction it's asking me for a private key - where do I get it from?

I tried copy-pasting the private key from my address in the Electrum wallet but I get an error message "There is a problem with one or more of your inputs, please check and try again".

Any idea how to resolve this?

legendary
Activity: 3472
Merit: 10611
go to https://coinb.in/#newTransaction
in first textbox enter the redeem script and click load, the site automatically converts it to the address and fetches the Unspent Transaction Outputs. the rest of the boxes should be clear to set the inputs and outputs. then you just have to take that raw tx and sign it with their sign page https://coinb.in/#sign

Sorry for my ignorance but WHAT is testnet?!
testnet is separate but with exact rules as main bitcoin network that is used for testing.
sr. member
Activity: 1877
Merit: 389
Is it non-testnet funds? Yes?

Sorry for my ignorance but WHAT is testnet?!

You just have to paste the redeem script above then click load (you need to be online).

WHERE do you paste it?!

Please please please ELABORATE... I am not a techie guy.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
Is it non-testnet funds? Yes?

You just have to paste the redeem script above (New->Transaction) then click load (you need to be online).
Then all inputs should be displayed.

If you prefer "that" method, yes you can.
  • Click Inputs tab, paste all of the required info, I guess you already know "Transaction ID" & "Amount".
  • The "N" means tx input number, stating with 0 for the upper-most input.
  • Script, your address' redeem script.
  • in the Outputs tab, paste the receiver's address and the amount to send (the excess will be used as fee).

Proceed to Verify, Sign then Broadcast.

Note: coinb.in might not be using our local time, my tx wasn't accepted by some nodes.
-edit-
This thread mentioned that it uses UTC for the date/time selection UI.
That explains why it still wasn't propagated yet (it's 8AM UTC while I set the timelock to 3:20PM).
At least we now know that the script is working Wink
sr. member
Activity: 1877
Merit: 389
you need to manually add the txid, input number, script and amount.

This is how I get an access back to the funds?
How exactly do I do it in simple English? I'm sorry but most of the terms you used were gibberish to me.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-snip-
After reading his reply, I have tried it using bitcoin testnet coins and I found out that coinb.in is also capable of signing transactions with CLTV.
That's quite expected since they offer creation of "Time Locked Address".

-edit: replaced using pooya's workaround-
TXID: 7aea29fc36e56b277ec23b31c792f0182f030bbef32bd39cb451f512ccb5e5a2


For testing coinb.in in testnet, you won't be able to create the raw transaction using "load" method, you need to manually add the txid, input number, script and amount.
You also won't be able to broadcast using the broadcast tab.
For mainnet, everything should work smoothly.
sr. member
Activity: 1877
Merit: 389
I agree with pooya's suggestion, but knowing that we are governed mostly by decentralized things, why would you want yo entrust your funds to another party that may or may not take interest with your money? One solution would be keeping the funds on a machine, say a smartphone that you won't use for x amount of time and only take it out once you need the coins. In this case you still have full control of the funds and would be saved from the anxiety of someone possibly taking out your money from you.

Hypothetically you're right, but Pooya provided a nice solution which I'm currently testing. Just had a few questions for him about it (please see above) - if you are willing to help with the questions instead of starting a hypothetical discussion about the needs to do this or not (which is great to be discussed in another topic IMO) - then that would be much more appreciated as I'd appreciate help with Pooya's suggestion.

Thanks!
legendary
Activity: 3542
Merit: 1352
Cashback 15%
I agree with pooya's suggestion, but knowing that we are governed mostly by decentralized things, why would you want yo entrust your funds to another party that may or may not take interest with your money? One solution would be keeping the funds on a machine, say a smartphone that you won't use for x amount of time and only take it out once you need the coins. In this case you still have full control of the funds and would be saved from the anxiety of someone possibly taking out your money from you.
sr. member
Activity: 1877
Merit: 389
Pooya,

I am using Electrum, I generated a Public Key to one of the addresses in my Electrum wallet and pasted it in the link you provided:

https://coinb.in/#newTimeLocked

I set up a test time for half an hour from now (assuming this page takes my local time, right?)

It gave me a BTC deposit address, I sent a few cents there for testing purposes.

I got a "Redeem Script" which is just a combination of letters and numbers as well as a Shareable URL that uses this "Redeem Script"

Okay, how do I move on from here? I mean how do I get the few cents back now?

Would appreciate your help and sorry for my ignorance.
legendary
Activity: 3472
Merit: 10611
~
Thanks a lot!
Can you trust this service? Is it reliable?

the address creation part from a public key doesn't have that much to trust if you understand what it returns. as for signing part, as i said i am not sure how you can use it to sign this type of transaction. but if there is a way, you can trust it by checking the source code here: https://github.com/OutCast3k/coinbin/ and making sure to clone the code and run it locally.

an example:
pubkey: 03DB114DE0DC61D5445B801DEAB2D9A32810B7BC5C5CF18CDA31F78827CD5A472F
date and time: 11/29/2019 13:42
the redeem script: 04f0eee05db1752103db114de0dc61d5445b801deab2d9a32810b7bc5c5cf18cda31f78827cd5a4 72fac
if we break it apart it is like this:
04 <- size of the locktime
f0eee05d <- locktime epoch value in little-endial hex = 1575022320 = Friday, November 29, 2019 10:12:00 AM https://www.epochconverter.com/ (note that the site used my local time which is GMT+03:30)
b1 <- OP_CLV
75 <- OP_DROP
21 <- size of public key = 33 bytes
03db114de0dc61d5445b801deab2d9a32810b7bc5c5cf18cda31f78827cd5a472f <- the public key
ac <- OP_CheckSig

as you can see there isn't any magic going on here. you could create it by hand yourself too!
then you hash this redeem script just like the way you hash your multisig redeem script:
e11a62c5a409aead78491fd34aa15aca58cf2e6d
add P2SH address version byte and encode it with base58:
05e11a62c5a409aead78491fd34aa15aca58cf2e6d(2545c46b=chcksum)
the result is 3NDFa2QeDcRvuCJ1uDGMDMaT2Q8w85ugvn
sr. member
Activity: 1877
Merit: 389

Why would you be needing to lock your bitcoins for 24 hours ? It is better you keep in your wallet and do not trust any third party services.
Secondly if you're looking to get interest over your deposited/locked bitcoin, no one will give you interest for just 1 -2 days. There are services which give you interest over a period of one or more months, but it is a risky business and many people have lost their bitcoins by these so called investments.

There is a need to lock it for several days, if it requires explanation I can provide it later, I'm firstly asking if such service exists.

Regarding interest % - you're wrong, FreeBitco.in pays a daily interest, without any commitment whatsoever - the issue with them is that they allow you to withdraw the Bitcoin instantly so it's not a good solution.
mk4
legendary
Activity: 2870
Merit: 3873
Paldo.io 🤖
for now there is only one place i know of that lets you do that and it is https://coinb.in/#newTimeLocked

Looks decent. Seriously though OP, just so if you're just planning on locking your bitcoins just so you really won't be tempted to spend the coins in whatever way, you don't need a bitcoin lock solution. You need to learn to have discipline and learn to have control over your actions. Seriously. This will do good for you on multiple aspects of life, not only with holding bitcoin.
legendary
Activity: 3472
Merit: 10611
is there a service that can let you deposit your Bitcoin and get it back after 24 hours or something similar?

we reside in a decentralized system, you should not even want to use a "centralized service" to do a simple thing for you like this. it is a bad idea by principle not to mention how most of these services are risky to use.

the decentralized solution is using locktime as @mjglqw said. but you don't need programming knowledge you only need a wallet/tool that lets you create these types of transaction (or request you favorite wallet to add the feature).
for now there is only one place i know of that lets you do that and it is https://coinb.in/#newTimeLocked
- create a new key pair, copy its public key and enter it in the link above
- enter a date and time or a block height that you want your coins to be released/unlocked at
- press submit
- copy the address and the redeem script
- send your coins there

PS. spending these coins is as simple as providing a single signature and the redeem script but i am not sure how to sign using this tool since i have never used it.
hero member
Activity: 1008
Merit: 531
Let's say I have some Bitcoin and I want to lock the Bitcoin away for many reasons - is there a service that can let you deposit your Bitcoin and get it back after 24 hours or something similar?

Perhaps you can even earn a small interest % on the Bitcoin whilst it's there?

Do you know of any reliable service that does it?

I'm not sure about short term ones where you can lock away your BTC, but there are a lot of options for you to keep BTC away, I think companies like Nexo will offer you monthly rates, where you can't withdraw your money for a month, and you get some nice interest as well.

I get a feeling that this is a possible gambling/spending addiction. If you really do feel like your addicted, you can buy containers that can hold things, and then plop your ledger inside, set the timer for several hours and then be forced to resist.
Pages:
Jump to: