So I wasn't quite sure what to search for on this topic, so this is probably a repeat. Please point me to it if it exists already.
Lots of people have asked if there is a way to control the direction of money behind an address/script. Through conventional means, the answer has always been: "No, the network only defines conditions to unlock the money, but can't control what is done with it." If you have the private key(s) for the money to be unlocked, you can do whatever you want with that money.
However, I realized that this is very much possible, through unconventional means. For instance, it's possible to "lock" money until a given time by doing the following.
- Produce two private keys, with addresses A and B.
- Send money to address A
- Create timelocked transaction sending all outputs of A to B
- Sign it with A
- Store signed tx in a safe place
- Destroy private key A
Although I hate the idea of destroying private keys that still have money, this does achieve what was requested (as long as you can be confident that the tx is valid and can be mined). The money is locked with no way to be moved until the locktime expires, and it will only move to address B. There is also no time limit by which it needs to be broadcast, you could keep it in A until you need it, long past the lock time.
The downsides include:
- (1) If a crazy bug leads to a bad signature or tx, then the money is locked forever
- (2) Who's going to destroy their private key that has money associated with it? Users would probably save the private key in some remarkably inconvenient form that would be difficult to recover, but possible if absolutely necessary (encrypt it with a random 50-bit key that will have to be brute-forced, and then bury it in your backyard yard?)
- (3) If key B is compromised, trying to remove the money becomes a race: as soon as the tx(A->B) hits the network, both you and the attacker are racing to move the new output. You have an advantage though (if you know B was compromised), as you create the signature with A, so you know the OutPoint that needs to be spent by B, and can prepare a subsequent spend and broadcast it 1 microsecond after you broadcast the first tx. But that's by no means any guarantee that yours will be mined, especially if the attacker knows miners who will give him priority (and especially if replace-by-fee is standard)
Above I have only mentioned time-locking money. I bet if you combine creative scripts and multiple transactions, there's some cool stuff you could do. But you have to be careful with creating chained transactions, because the malleability of transactions means that you create A-->B and pre-prepare B-->C, but then some jerk on the network mines A-->B after adding an extra padding byte to your signature and the tx hash changes, then your B-->C tx is invalid (because it references A-->B by hash, which is no longer valid). I know we enforced canonical signatures, but I assume that's not a hard network rule (yet?).
So what else can be done with this? Is it actually useful?