What is a Timelock Contract?
A timelock contract is a smart contract mechanism that enforces a mandatory waiting period between when a transaction is proposed and when it can be executed. This delay gives users and stakeholders time to review proposed changes, exit the protocol if they disagree, or alert the community to malicious proposals before they take effect.
How it Works
Timelocks operate as transaction queues with enforced delays. When administrators want to execute a privileged action, they must first queue the transaction, then wait for the timelock period to expire before execution becomes possible.
The typical timelock workflow includes:
- Queue Transaction: Admin submits transaction to timelock
- Delay Period: Minimum waiting time before execution (often 24-48 hours)
- Grace Period: Window during which execution is valid
- Execution: After delay, anyone can execute the queued transaction
- Cancellation: Admin can cancel queued transactions before execution
Timelocks are often combined with multi-signature requirements and governance votes.
Practical Example
Compound's governance uses a 48-hour timelock for all protocol changes. When a governance proposal passes, its transactions are queued in the timelock, and execution must wait 48 hours. This gave users time to respond when a governance attack attempted to pass malicious proposals in 2023. Uniswap, Aave, and most major DeFi protocols implement similar timelock mechanisms for admin operations.
Why it Matters
Timelocks transform potential instant rug pulls into detectable, preventable events. Users have time to exit before harmful changes take effect. However, timelocks also slow legitimate security responses, requiring careful balance between security and agility. Evaluating timelock duration and coverage is essential for assessing protocol safety.
Fensory displays timelock information for DeFi protocols, helping users understand how much notice they will receive before significant protocol changes take effect.