buildDestination

Build a TimeLockVaultDestination for this contract's current index at the supplied blockHeight and cache it as destination.

Derived at the BIP-44 path used by Otoplo:

m / 44' / coinType' / [contractIndex]' / 0 / [index]
  • purpose is fixed at 44 (BIP-44).

  • coinType is taken from account.addressDerivationCoin.

  • account is contractIndex, default 1 (Otoplo convention).

  • change is always 0 (external chain).

  • address index is index — the contract's current leaf.

blockHeight is committed in the locking script as a visible arg, so it affects the resulting vault address but not the signing key.

Re-deriving with the same (seed, contractIndex, index, blockHeight) reproduces the same vault address — also the recovery path: scan for time-lock UTXOs and use the visible args to identify which (index, unlockValue) pair they came from.

This re-points the CURRENT leaf — it does not allocate a new vault. To open an additional vault alongside existing ones, advance the leaf first (nextDestination) or target a fresh index via the overload. A re-pointed vault is not lost: its destination stays tracked via the wallet's receiving map and its tagged UTXOs (knownVaults).


Jump the cursor to index and buildDestination there, keeping the LOCKTIME_THRESHOLD ceiling — use this to create a vault at a chosen leaf. Moving the cursor always rebuilds destination in the same step, so the two cannot drift apart.

To re-derive an existing on-chain vault during recovery — where the committed unlock value is dictated by the chain and may exceed the ceiling — use recoverDestination instead.