Locktimeis an optional part of Bitcointransactions. It sets the earliest time a transaction can be mined into a block, which means that the transaction only broadcasts when a certain time or block height has been reached. It is possible to use Locktime withTrezorto make sure that a transaction is locked until the desired block height is reached.
Why use Locktime?
Transactions can be prepared in advance and sent at a certain time. Locktime further improves privacy when Broadcast over a different network. Transactions can be created that will send funds to another address if the transaction is not replaced by a certain time, acting as a dead man's switch.
When to use Locktime
Locktime canpreserve privacyby letting you sign your transaction, copy the signed data to a memory stick, and broadcast it from a public location so you don't reveal your IP address or other identifying data.
Locktime can also be used to set funds to transfer if no action is taken by the user. This could be useful for easyinheritance planningfor cryptocurrency: send a transaction to an address owned by your next of kin with Locktime set for one year. If you are still alive and well when the transaction is due to be sent, resend the same transaction but extend the Locktime by one more year.
It sets the earliest time a transaction can be mined into a block. It is possible touse locktime with Trezorto make sure that a transaction is locked until a specific block height or a point in time.
How to use the Locktime feature
Broadcast is turned off by default when using Locktime, meaning you will receive raw text data to broadcast from a node. If Broadcast is on, the transaction will be sent over the current network.
1. Calculate the block you would like to add your transaction into: current block height + number of blocks to wait for adding the transaction.
Note: you can find the current block height on these blockchain explorers forBitcoinandLitecoin.
2. In the account Sendtab, click on 'Add locktime' in the bottom-left corner of the transaction details pane:
- This reveals the Locktimeinput field where you can specify the desired block:
3. If you add a future block as a locktime in your transaction, an error will appear on your screen. No need to worry, Trezor Suite just cannot broadcast the transaction because of the selected locktime. You can now copy the raw transaction in hex format and save it. It is necessary to broadcast the transaction after the given block is reached directly within Trezor Suite or by using any external broadcast transaction tool like this one.
Important: be sure to save your raw transaction data in a safe place, because anybody with access to it will be able to spend your coins.
How to Set a Precise Locktime
Using block height to set a Locktime is not very accurate as new blocks are mined on average once every 10 minutes, meaning around 144 blocks mined per day. This number varies depending on the state of the network, and some blocks can take much longer to be mined.
Unix timestampsare used for more precise timing synchronized across computers. They track the number of seconds which have passed since January 1, 1970.
Use aUnix timestamp converterto see the current timestamp and calculate a timestamp for a precise time in the future. Setting a Locktime is as simple as increasing the current timestamp by the number of seconds it should be delayed.
For example, if the current timestamp is 1625215800 and the desired Locktime is one week, the Unix timestamp to enter would be 1625820600 (the current timestamp plus one week, or 604800 seconds).