Post
Topic
Board Development & Technical Discussion
Merits 1 from 1 user
Re: Sending locked coins
by
NotATether
on 27/04/2021, 17:15:25 UTC
⭐ Merited by Belisarius (1)
Possibility 1: We sign the sale and I send a confirmation of the release.

Possibility 2: The sale does not take place and I automatically get my 10 BTC back after X hours.

I guess if you're looking for something simple you can look at the current block height and set the locktime field of the transaction to be N+current_height, N being the number of blocks you want the transaction to stay unconfirmed since it won't be included in any block before the N+current_height'th one.

A block takes on average 10 minutes to mine so a better value that would correspond to X hours is X*10*6 blocks: locktime=X*10*6+current_height.

That way there is blockchain proof that the transaction is pending and if whatever deal you have doesn't complete by then you can double-spend it back to yourself with a larger fee.