Home » Knowledge Base » Features » Bitcoin Miniscript »
Timelock
Use A Timelock To Optimise Your Multisig Setup
A Timelock can serve as an additional layer of security in multisig wallets or high-level smart contracts, offering temporal protection to your bitcoins. The UTXO’s in a multisig wallet can be subjected to a timelock, which restricts their use until a future, predetermined date. Consequently, even if a hacker gains access to your key, they are rendered impotent until the timelock concludes.
How Does A Timelock Work?
In the world of Bitcoin, timelocks are an advanced feature that delays the execution of transactions until a stipulated time has passed. These can be either relative (for instance, “1 year from the last time the wallet was used”) or absolute (for example, “on the 1st of March of 2024”). Timelocks can be used to force yourself to hodl and to make theft harder. It can be used in both singlesig and multisig.
Absolute Timelocks
Absolute Timelocks pinpoint a precise date or block height as their reference. As opposed to relative timelocks, absolute ones can extend to any desired length (up to a technical limit of 500 million blocks). They impose the same timelock on each UTXO in the wallet. The benefit here is the simultaneous expiration of timelocks for all UTXOs in the wallet, meaning users only need to remember a single deadline. This makes wallet management more straightforward and hassle-free.
Relative Timelocks
Relative timelocks allow for a maximum extension up to 65535 blocks into the future, equivalent to roughly 455 days. When a wallet employs relative timelocks, it implies that each UTXO’s timelock expires at a distinct time, contingent on the time and date of the UTXO’s deposit into the wallet. To reset a UTXO or “refresh” a relative timelock, the UTXO must be spent, accomplished via a self-transfer to a different address within the same wallet. However, to reset a timelock, an on-chain transaction is required, which includes transaction fees. This process can quickly become expensive if a wallet holds multiple UTXOs. Therefore, it is advisable to merge smaller amounts into larger UTXOs to decrease the financial burden associated with resetting timelocks.
Use For Multisig
Timelocks can be used in a multisig setup to protect the bitcoins against theft or to protect the user against panic selling. The coins are locked for a certain time, so both the user and a potential thief can’t send a transaction from the wallet within this time frame.
However, there is a possible drawback to consider for a multisig setup: If one of the signers get lost, a transaction to rotate this key (?) out of the setup can’t be made. The user would have to wait until the timelock expires. If another key get lost in this time and the total of lost keys exceed the threshold, the bitcoins in the wallet will be lost forever.