Bitcoin Forum
April 26, 2024, 01:48:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Creating a timelocked transaction  (Read 202 times)
unsigned_long_long (OP)
Jr. Member
*
Offline Offline

Activity: 39
Merit: 6


View Profile
December 26, 2017, 09:55:25 AM
Last edit: December 26, 2017, 10:37:36 AM by unsigned_long_long
 #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!
1714139299
Hero Member
*
Offline Offline

Posts: 1714139299

View Profile Personal Message (Offline)

Ignore
1714139299
Reply with quote  #2

1714139299
Report to moderator
I HATE TABLES I HATE TABLES I HA(╯°□°)╯︵ ┻━┻ TABLES I HATE TABLES I HATE TABLES
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
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
Legendary
*
Offline Offline

Activity: 2814
Merit: 6971



View Profile WWW
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!

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
vintagetrex
Sr. Member
****
Offline Offline

Activity: 490
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 (OP)
Jr. Member
*
Offline Offline

Activity: 39
Merit: 6


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
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!