ERGO
Time Locks & Access Control
Beginner
30 minutes

Block-Height Time Lock (Timelocked Payments)

Lock funds until a specific block height for scheduled payments

Problema

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

Soluzione

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).

Come funziona

  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

Esempi di codice

{
  // 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.

Casi d'uso

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

Considerazioni sulla sicurezza

  • !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

Risorse

Considerazioni sulle commissioni

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

Migliora le tue competenze ErgoScript

Ricevi notifiche su nuovi pattern, tutorial e risorse per sviluppatori.

Follow for daily updates