Bitcoin Forum
April 25, 2024, 12:50:44 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Time locked transactions  (Read 338 times)
bomberb17 (OP)
Hero Member
*****
Offline Offline

Activity: 771
Merit: 528



View Profile
May 30, 2018, 05:01:50 PM
 #1

I'm looking for information on time-locked transactions for bitcoin. How is this transaction created exactly? Does this transaction remain off-chain between the sender and the receiver until the time has elapsed? Does this transaction remain on the mempool until that time?
1714006244
Hero Member
*
Offline Offline

Posts: 1714006244

View Profile Personal Message (Offline)

Ignore
1714006244
Reply with quote  #2

1714006244
Report to moderator
1714006244
Hero Member
*
Offline Offline

Posts: 1714006244

View Profile Personal Message (Offline)

Ignore
1714006244
Reply with quote  #2

1714006244
Report to moderator
1714006244
Hero Member
*
Offline Offline

Posts: 1714006244

View Profile Personal Message (Offline)

Ignore
1714006244
Reply with quote  #2

1714006244
Report to moderator
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714006244
Hero Member
*
Offline Offline

Posts: 1714006244

View Profile Personal Message (Offline)

Ignore
1714006244
Reply with quote  #2

1714006244
Report to moderator
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
May 30, 2018, 06:00:38 PM
 #2

I assume you are referring to nLocktime. It is simply a parameter in every Bitcoin transaction that can be set to zero.
Yes, the nLocktime value means that the transaction can not be added to a block that has a lower block number than the one specified in the nLocktime filed.

https://en.bitcoin.it/wiki/Protocol_specification#tx
Heisenberg_Hunter
Legendary
*
Offline Offline

Activity: 1583
Merit: 1276


Heisenberg Design Services


View Profile WWW
May 30, 2018, 07:31:31 PM
Merited by DarkStar_ (2), Xynerise (2), bones261 (1)
 #3

I'm looking for information on time-locked transactions for bitcoin.
Time Locking is a feature which when enabled restricts you to spend the btc present in the wallet for a certain time period or until the network reaches a specific block height. Time Locking features are used frequently for investment purposes or locking of funds for the heirs.

How is this transaction created exactly?
At the time of this writing, the block height is 525160. Create a transaction and enter the nlocktime say 650000.
The bitcoinj library has a command line tool that can be used to create such transactions.
Unless the blockheight entered hasn't been exceeded, your transaction is invalid, won't get confirmed and would never be broadcasted in the network.

Does this transaction remain off-chain between the sender and the receiver until the time has elapsed?
Yes transaction is invalid and would remain off-chain until the specified blockheight is reached. If you broadcast the transaction before the blockheight, it will not get included in the blocks. You can even cancel the transactions before the locktime is reached.

Does this transaction remain on the mempool until that time?
No. Mempool consists of unconfirmed transactions. Mempool consists of set of transactions that are broadcasted in the network but are not included in the blocks by a miner. Locktime transactions are not broadcasted to the network before the blockheight is reached. So you need to store the transactions in a safe place and need to broadcast it to the network at the right time when the locktime reaches.


More about Locktime here
Someone correct me if I am wrong   Embarrassed


bomberb17 (OP)
Hero Member
*****
Offline Offline

Activity: 771
Merit: 528



View Profile
May 31, 2018, 03:08:11 AM
 #4

Ok let me make my question more specific:
Suppose I create a transaction with OP_CHECKLOCKTIMEVERIFY set into some block in the future. I understand that this transaction is invalid until we reach that block.
My question was after I create and sign this transaction, what do I do with it? Of course it cannot be mined since it is invalid. Heisenberg_Hunter said I can only store it in a safe place, maybe sending it to the recipient letting him know that I have this transaction ready to broadcast it as soon as I can. But is it somewhere documented that it cannot be broadcasted by bitcoin nodes?
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
May 31, 2018, 03:41:56 AM
Merited by DarkStar_ (2)
 #5

Yes. Effectively... nLockTime is a bit like a "Dead Man's Switch".

You setup a transaction, that is not valid until X time (X = block number). Any time before X, you can invalidate that transaction simply by spending one of the inputs in a different transaction. If no action is taken, then the original transaction can be broadcast as a valid transaction after X has occurred.

GreenAddress uses nLockTime as a fail-safe for it's MultiSig wallets... They create a (partially) signed transaction (with their key) that sends all your funds to a nominated address from your 2-of-2 wallet with an nLockTime calculated to be around 90 days in the future. This way, if GreenAddress service goes down, you can simply sign the transaction with your key (so it is fully signed), and then broadcast it to recover your funds in 90 days.


But is it somewhere documented that it cannot be broadcasted by bitcoin nodes?
I don't think there is anything specifically documented that it cannot be broadcast... I think it's more just that because the transaction is considered "invalid" due to the lockTime that nodes will treat it like any other "invalid" transaction (bad signature, "missing" inputs, zero fee etc) and reject it (and thus refuse to broadcast/relay it).


My question was after I create and sign this transaction, what do I do with it?
All you can do is store it somewhere... most nodes won't accept invalid transactions, so attempting to broadcast it likely won't work. Why would a node want to store an "invalid" transaction in it's mempool? There is no point.

It isn't "unsafe" to have it stored somewhere (email, cloud storage, harddrive, given to recipient etc.) because, as already mentioned, if you change your mind you can simply invalidate it by spending one of the inputs in a transaction prior to nLockTime, and no-one can alter the "signed" transaction.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
eternalgloom
Legendary
*
Offline Offline

Activity: 1792
Merit: 1283



View Profile WWW
June 01, 2018, 05:26:42 PM
Merited by HCP (1)
 #6

I've also asked a similar question before on this forum and got a really amazing reply.
Easy step-by-step instructions to create a time-locked transaction.

https://bitcointalk.org/index.php?topic=2415595.msg24710770#msg24710770

I know you're probably looking for a more in-depth technical answer, but just sharing this in case anyone else is interested in creating a time-locked transaction.

Salmen
Legendary
*
Offline Offline

Activity: 1059
Merit: 1020


View Profile WWW
June 02, 2018, 09:39:26 AM
 #7

Concerning for the information about a time-locked address, you can verify the time until the funds have been locked, the address whose permission is required to withdraw the funds and the address where the funds are located, using Coinb.in.

Young Developer amidst Europe. Specialized in Web Programming and Creating Telegram Bots. Looking for a developer? Feel free to drop a mail to me.
Running JaguarBitcoin - Your Place For Scripts
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
June 05, 2018, 08:58:57 AM
 #8

How is this transaction created exactly? Cry Cry Cry

What about reading the previous replies?
The answer to your question already has been posted:

I've also asked a similar question before on this forum and got a really amazing reply.
Easy step-by-step instructions to create a time-locked transaction.

https://bitcointalk.org/index.php?topic=2415595.msg24710770#msg24710770



For a set-by-step guide with picture, you can visit https://steemit.com/bitcoin/@daan/how-to-create-time-locked-transactions-with-bitcoin-free-bitcoins-inside.

eternalgloom
Legendary
*
Offline Offline

Activity: 1792
Merit: 1283



View Profile WWW
June 05, 2018, 06:42:59 PM
 #9


I've also asked a similar question before on this forum and got a really amazing reply.
Easy step-by-step instructions to create a time-locked transaction.

https://bitcointalk.org/index.php?topic=2415595.msg24710770#msg24710770



For a set-by-step guide with picture, you can visit https://steemit.com/bitcoin/@daan/how-to-create-time-locked-transactions-with-bitcoin-free-bitcoins-inside.

Lol, I've written that article myself and I even used the Bitcointalk thread I've posted as a source for that article (it's mentioned at the bottom)
I'd suggest just following Tryninja's instructions (in the thread I posted), if you know what you're doing. It's much faster that way.

Deepa Singh
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
June 05, 2018, 08:49:51 PM
 #10

Can anyone tell me how to unlock the transection in between?
eternalgloom
Legendary
*
Offline Offline

Activity: 1792
Merit: 1283



View Profile WWW
June 05, 2018, 08:52:57 PM
 #11

Can anyone tell me how to unlock the transection in between?


You mean unlock it before the timelock has expired?
I'm afraid that's not possible, unless you've accidentally made a mistake while creating the timelock.

This is what Achow mentioned on my other thread:

Quote
A transaction with a timelock means that the transaction itself cannot confirm before the timelock (either a block height or a timestamp). However a conflicting transaction (one that spends the same inputs) could be created and that transaction can still confirm.

In order to make coins that are unspendable until after a certain time or block height, you will need to create an address that uses OP_CHECKLOCKTIMEVERIFY. Only coins sent to such an address are guaranteed to be only spendable after a certain time.

Source: https://bitcointalk.org/index.php?topic=2415595.msg24712001#msg24712001

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!