Skip to main content
VTXO Management automates the renewal and recovery of virtual coins to prevent expiration and loss of funds. VtxoManager is also accessible from ServiceWorkerWallet via wallet.getVtxoManager().

Overview

VTXOs can be in different states and have an expiration time based on the batch expiry. The VtxoManager class provides automated management for:
  • Renewal: Renew VTXOs before they expire to maintain unilateral control of your funds
  • Recovery: Reclaim expired and swept VTXOs back to your wallet

Creating a VTXO Manager

renewalConfig with enabled and thresholdMs is deprecated. Prefer settlementConfig on the wallet, where vtxoThreshold is expressed in seconds.

VTXO Renewal

Renew VTXOs before they expire to keep your liquidity available. This settles all VTXOs (including recoverable ones) back to your wallet with a fresh expiration time.

Checking Expiring VTXOs

  • timeLeft: remaining time until expiry (batchExpiry - current time) in milliseconds
  • hoursLeft: remaining time in hours, derived from timeLeft

Renewing VTXOs

Set up automatic renewal checks in your application to ensure VTXOs never expire. A good practice is to check daily and renew when the threshold is reached.

VTXO Recovery

Recover VTXOs that have been swept by the server or consolidate small amounts (sub-dust).

Checking Recoverable Balance

Response shape:

Recovering VTXOs

Best Practices

Implement automatic renewal checks in your application:
Periodically check for recoverable funds:
The threshold specifies how much time must remain before a VTXO is flagged for renewal. Adjust the threshold based on your needs:
  • 3 days (default): Good balance between proactive renewal and transaction costs
  • 1 day: More aggressive, suitable for high-value or frequently active wallets
  • 7 days: More relaxed, suitable for infrequently used wallets

Complete Example

Here’s a complete example of VTXO management:

Next Steps