Bitcoin Forum
May 21, 2024, 09:46:47 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Correct steps for a delayed transaction?  (Read 1517 times)
voileipa (OP)
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
September 09, 2014, 12:59:09 PM
Last edit: September 09, 2014, 01:27:50 PM by voileipa
 #1

I'm trying to create create a delayed transaction for myself. I'm using nLockTime and the following steps. The situation what I'm trying to reach is that there are 1 BTC that is not reachable until 10 000 blocks are found.

Are the following steps correct?

1. I create a new key-address pair. (KEY1 1Address1)
2. I send 1BTC to address 1Adddress1
3. I create new key-address pair. (KEY2 1Address2)
4. I create a transaction with nLockTime (currentblockheight + 10000). The input is 1Address1 and output 1Address2. I sign it with KEY1. HOWEVER, I do not broadcast the transaction.
5. I destroy KEY1.
6. Now I have a transaction, which is now valid until 10 000 blocks are found and I store it. After 10 000 blocks are found I broadcast the transaction and unlock the bitcoins with KEY2.

Does this work or can I just replace the nLockTime in the transaction with 0, so the transaction becomes instantly valid?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
September 09, 2014, 01:50:40 PM
 #2

I'm trying to create create a delayed transaction for myself. I'm using nLockTime and the following steps. The situation what I'm trying to reach is that there are 1 BTC that is not reachable until 10 000 blocks are found.

Are the following steps correct?

1. I create a new key-address pair. (KEY1 1Address1)
2. I send 1BTC to address 1Adddress1
3. I create new key-address pair. (KEY2 1Address2)
4. I create a transaction with nLockTime (currentblockheight + 10000). The input is 1Address1 and output 1Address2. I sign it with KEY1. HOWEVER, I do not broadcast the transaction.
5. I destroy KEY1.
6. Now I have a transaction, which is now valid until 10 000 blocks are found and I store it. After 10 000 blocks are found I broadcast the transaction and unlock the bitcoins with KEY2.

Does this work

Yes.

or can I just replace the nLockTime in the transaction with 0, so the transaction becomes instantly valid?

No.  If you replace nLockTime, then the signature is no longer valid.
Buffer Overflow
Legendary
*
Offline Offline

Activity: 1652
Merit: 1015



View Profile
September 10, 2014, 07:15:35 AM
 #3

I should do some attempts on the testnet before trying out for real. Just in case something goes wrong.

voileipa (OP)
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 02, 2014, 02:20:08 PM
 #4

Hhhm.. the nLockTime is not working.

I created a transaction with locktime = 630000 but it is still included in the blockchain

https://blockchain.info/tx/18b598bd76110151d6bea797d3c10bcfdc44454303da6d74fbd3f15c5e851d0a

Buffer Overflow
Legendary
*
Offline Offline

Activity: 1652
Merit: 1015



View Profile
November 02, 2014, 02:55:23 PM
 #5

Hhhm.. the nLockTime is not working.

I created a transaction with locktime = 630000 but it is still included in the blockchain

https://blockchain.info/tx/18b598bd76110151d6bea797d3c10bcfdc44454303da6d74fbd3f15c5e851d0a



If all TxIn inputs have final (0xffffffff) sequence numbers then locktime is ignored.

voileipa (OP)
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 02, 2014, 05:43:28 PM
 #6

Hhhm.. the nLockTime is not working.

I created a transaction with locktime = 630000 but it is still included in the blockchain

https://blockchain.info/tx/18b598bd76110151d6bea797d3c10bcfdc44454303da6d74fbd3f15c5e851d0a



If all TxIn inputs have final (0xffffffff) sequence numbers then locktime is ignored.

Thanks for the response. I set the sequence number to 0 and after that my bitcoind didn't broadcast the transaction until the given block height was reached:

Code:
>./bitcoin-cli sendrawtransaction $SIGNED_RAW_TX                  
error: {"code":-26,"message":"64: non-final"}

After the block height was reached I finally got the transaction in the block chain as expected:
https://blockchain.info/tx/d61839fb690395ba638ba804c5af4bf0111ff269ca1e0b251cff737ca6189557


I hope all nodes will relay (now and in future) transactions with custom nLockTimes and sequences!
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!