Time-Lock Contract – Gold Standard Technical Record
Um smart contract pattern determinístico que bloqueia assets ou dados por um período predefinido e libera automaticamente após a expiração.
Um Time-Lock Contract é um smart contract pattern determinístico comumente usado em aplicações blockchain, particularmente em decentralized finance (DeFi) e gestão de criptomoedas. Sua função principal é impor um período de espera antes que um asset ou uma ação específica possa ser acessado ou executado. Tipicamente, um time-lock contract detém fundos ou dados e é programado com um timestamp futuro ou block height. Ao atingir este tempo predeterminado, o contract libera automaticamente os assets bloqueados ou habilita uma função específica, como desbloquear um vesting schedule para tokens ou permitir um withdrawal. Este mecanismo aumenta a segurança prevenindo acesso prematuro e pode ser usado para implementar features como delayed transactions, vesting periods para distribuições de tokens, ou serviços de escrow. A natureza determinística garante que a condição de liberação seja atendida unicamente com base na passagem do tempo ou progressão de blocos, sem requerer oracles externos para o aspecto de time-keeping, confiando em vez disso no relógio interno da blockchain ou block height.
graph LR
Center["Time-Lock Contract – Gold Standard Technical Record"]:::main
Pre_logic["logic"]:::pre --> Center
click Pre_logic "/terms/logic"
Center --> Child_oracles["oracles"]:::child
click Child_oracles "/terms/oracles"
Center --> Child_smart_contract_security["smart-contract-security"]:::child
click Child_smart_contract_security "/terms/smart-contract-security"
Rel_smart_contracts["smart-contracts"]:::related -.-> Center
click Rel_smart_contracts "/terms/smart-contracts"
Rel_advanced_propulsion_systems["advanced-propulsion-systems"]:::related -.-> Center
click Rel_advanced_propulsion_systems "/terms/advanced-propulsion-systems"
Rel_collateralized_debt_position_cdp["collateralized-debt-position-cdp"]:::related -.-> Center
click Rel_collateralized_debt_position_cdp "/terms/collateralized-debt-position-cdp"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 Explique como se eu tivesse 5 anos
Um time-lock contract é como um cofrinho digital com um timer. Você coloca seu dinheiro, define uma data, e ninguém (nem mesmo você!) pode retirá-lo até que essa data chegue.
🤓 Expert Deep Dive
Time-lock contracts leverage the inherent immutability and deterministic execution of smart contracts. The locking condition is typically implemented using block.timestamp or block.number (for block height) checks within the contract logic. For instance, a require(block.timestamp >= unlockTime) statement prevents execution until the specified time. This pattern is fundamental for secure vesting schedules, preventing rug pulls in token launches, and implementing atomic swaps where both parties must wait for a specific condition. Trade-offs include the potential for front-running if the unlock action is initiated by a transaction that can be observed before it's mined, and the reliance on the blockchain's timestamp accuracy, which can be subject to miner manipulation, although this is generally difficult to exploit significantly for time-locks. The 'Gold Standard Technical Record' designation implies a robust, well-audited, and widely accepted implementation of this pattern.