Bitcoin Forum
September 22, 2018, 12:24:57 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Creating a timelocked transaction  (Read 68 times)
unsigned_long_long
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
December 26, 2017, 09:55:25 AM
 #1

Hi,

I have a new nephew and I want to give him a gift of some Bitcoin which he (or his parents) can't access until he's older,say 10 years old.

Here's my plan:

1. Create 2 brand-new bitcoin private keys, and derive their corresponding the addresses. Call these the 'storing address' and 'redeeming address'
2. Send the gift from one of my wallets to the storing address.
3. Construct an offline P2PKH transaction with an nLockTime of the approximate block number 10 years from now. Give this transaction one input - the storing address's one UTXO, and one output - the redeeming address.
4. Sign the transaction with the storing address's key
5. Destroy the storing address's key

So now I have the raw transaction which (because it's signed) can't have the locktime modified. To redeem the funds in 10 years, he'll have to set up a wallet, import the redeeming address's key, then we broadcast the transaction, which will now succeed and the funds will appear in his wallet.

Can anybody identify any possible issues with this strategy? One thing I'm worried about is fees. It's impossible to estimate what fees will be like in 10 years time, but if I use replace-by-fee, (as far as I understand) I'll have to re-sign the transaction, thus I'll need to keep the storing address's key. I'd rather throw it away, that way there's no way to access the funds until the nLockTime has passed.

Appreciate any comments!
1537619097
Hero Member
*
Offline Offline

Posts: 1537619097

View Profile Personal Message (Offline)

Ignore
1537619097
Reply with quote  #2

1537619097
Report to moderator
1537619097
Hero Member
*
Offline Offline

Posts: 1537619097

View Profile Personal Message (Offline)

Ignore
1537619097
Reply with quote  #2

1537619097
Report to moderator
1537619097
Hero Member
*
Offline Offline

Posts: 1537619097

View Profile Personal Message (Offline)

Ignore
1537619097
Reply with quote  #2

1537619097
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Sats.Obol
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile WWW
December 26, 2017, 05:46:31 PM
 #2

I may be wrong and I'm new to blockchain technology but researching and studying daily.

but what you describes sounds like a Smart Contract, as it doesn't executes fully until certain conditions have (or have not) been met.
also, the first half sounds like you could use a ring signature which would require signatures from all parties involved to release tokens (if I understood it correctly)
TryNinja
Hero Member
*****
Offline Offline

Activity: 770
Merit: 759


ChipMixer's Badge of Honor


View Profile
December 26, 2017, 05:53:15 PM
 #3

I believe that there are better ways to do that. This is the method I already used in the past and recommend:

For that, you will need to use Coinb.in, which is an open source tool and can be downloaded and run locally.

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!

vintagetrex
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
December 26, 2017, 06:32:41 PM
 #4

I don't think that the length of the blockchain is a strong enough number to be used for cryptographic purposes.  Short answer is that this is an unsolved problem in crypto currency, unless you're using an ethereum contract.  This requires consensus of a network and can't be done cryptographically.  You're requiring a known strong random number that then becomes unknown and can't be brute forced, all while knowing the amount of time until that number hits to allow the release of the coins. 
unsigned_long_long
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
December 26, 2017, 07:09:29 PM
 #5

I believe that there are better ways to do that. This is the method I already used in the past and recommend:

For that, you will need to use Coinb.in, which is an open source tool and can be downloaded and run locally.

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!

This is pretty interesting! I'll take a look, thanks!
pebwindkraft
Full Member
***
Offline Offline

Activity: 246
Merit: 202


View Profile
December 26, 2017, 09:11:38 PM
 #6

...Short answer is that this is an unsolved problem in crypto currency, unless you're using an ethereum contract...
what??? unsolved problem? How do you derive this statement? What is unsolved?
Can you outline, what ethereum can do here? Transfer funds from bitcoin to eth, just to do a later payment, and then back to bitcoin?
Or are you just repeating the standard meme "smart contrct = ethereum", without respecting the original question?

In this very long thread on smart contracts others explained the possibilities for smart contracts as per today, and I added some references.
They fit exactly to the authors needs. No switch to ethereum or turing completeness or solidity required. 

https://bitcointalk.org/index.php?topic=2204938.msg23664225#msg23664225
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!