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.