ERGO
Time Locks & Access Control
Beginner
30 minutes

Block-Height Time Lock (Timelocked Payments)

Lock funds until a specific block height for scheduled payments

Problem

You need to lock funds until a future date for vesting, escrow, or scheduled payments.

Çözüm

ErgoScript can check the current block HEIGHT against a target. Funds remain locked until the blockchain reaches the specified height (~2 min/block on Ergo).

Nasıl Çalışır

  1. 1Calculate target block height: current + (days * 720) for approximate timing
  2. 2Ergo averages ~2 minutes per block (720 blocks/day)
  3. 3Contract checks HEIGHT >= targetHeight before allowing spend
  4. 4Before target: funds are locked, no spending possible
  5. 5After target: only the designated beneficiary can claim

Kod Örnekleri

{
  // Lock until block height 1,500,000
  val unlockHeight = 1500000
  val beneficiary = PK("9f...")  // Beneficiary public key
  
  // Can only spend after unlock height
  HEIGHT >= unlockHeight && proveDlog(beneficiary)
}

Simplest time lock. Funds are locked until the specified block height, then only the beneficiary can claim.

Kullanım Alanları

  • Team token vesting schedules
  • Scheduled salary payments
  • Escrow with timeout refunds
  • Inheritance and succession planning
  • Delayed governance execution
  • Bond maturity contracts

Güvenlik Hususları

  • !Block times can vary slightly - don't rely on exact timing
  • !Consider adding emergency unlock with multi-sig
  • !Test unlock conditions thoroughly on testnet
  • !Keep fee reserves for future unlock transactions

Kaynaklar

Ücret Hususları

Standard transaction fees. Reserve ~0.01 ERG for future unlock transaction.

ErgoScript Becerilerinizi Geliştirin

Yeni kalıplar, öğretici içerikler ve geliştirici kaynakları hakkında bildirim alın.

Follow for daily updates