> ## Documentation Index
> Fetch the complete documentation index at: https://second.tech/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Display expired VTXOs and recoverable balance

> Show expired VTXOs as recoverable bitcoin that needs action, not a loss. State labels, copy guidance, and the dust floor to surface before a refresh fails.

Expiry happens when a device stays offline past the refresh window, or when a wallet holds a few hundred sats it cannot refresh on its own. It also happens when an Ark payment reaches the wallet only after its VTXO expired.

## Keep expired bitcoin in the balance

Show the amount, split out from the healthy balance and labeled as needing action. A balance that silently drops to zero asserts a loss that has not happened. Users believe it.

* **The keys still work:** The wallet app still holds the keys to an expired VTXO and can refresh it ([VTXO lifetime](https://second.tech/docs/learn/lifetime.md) covers the sweep).
* **The exit guarantee has lapsed:** The pre-signed emergency exit no longer protects the VTXO. Recovery depends on the Ark server's cooperation ([what remains possible after expiry](https://second.tech/docs/learn/lifetime.md#what-happens-when-vtxos-expire)).
* **Bark still counts it:** Bark reports the expired VTXO in `needs_refresh_sat` (`needsRefreshSats` in the SDK), not in `spendable_sat` (`spendableSats`), and skips it as an input for Ark sends. The same field also holds VTXOs whose exit depth has reached the server's limit. The next maintenance pass treats each of them as a mandatory refresh.

> [!WARNING]
>
> **Refresh an expired VTXO, do not exit it**
>
> Once the chain tip reaches a VTXO's expiry height, the server can sweep it at any block. An emergency exit is no longer safe, because the sweep spends the same outputs the pre-signed exit transactions depend on. Refresh is the normal recovery path, and an urgent one.

## Name the lifecycle states

Derive each VTXO's state by comparing its `expiry_height` (in every VTXO record of the JSON and REST APIs) against the chain tip.

| State | When | What your app does | What the user sees |
| - | - | - | - |
| Active | The tip is comfortably below `expiry_height`. | Nothing special, since [scheduled maintenance](https://second.tech/docs/patterns/maintenance.md) refreshes in time. | The normal balance, nothing about expiry. |
| Expiring soon | Within the refresh threshold of expiry ([maintenance](https://second.tech/docs/patterns/maintenance.md#run-maintenance-at-least-daily) covers the default). | Refreshes it in the next maintenance pass. | Still nothing, unless the app has been unable to run maintenance for a long stretch. Only then a warning with a deadline. |
| Expired, needs action | The tip reached `expiry_height`. | Refreshes immediately, after checking the dust floor below. | The amount from `needs_refresh_sat`, kept visible and labeled "Needs refresh". Never zero. |

Keep an expired amount visible and keep retrying its refresh. An exit that finds its chain swept ends in the `vtxo-swept` state.

## Say what the user can do, not what they lost

Point every message at the action that recovers the sats.

| Instead of | Say |
| - | - |
| "Balance: 0 sats" | "4,300 sats · needs refresh" |
| "Your bitcoin has expired and cannot be recovered." | "Part of your balance needs a refresh. Open the app to complete it." |
| "Refresh failed: amount too low." (after the attempt) | "Add at least 200 sats before this balance can be refreshed." (before the attempt) |

Never use "irrecoverable", "lost", or "expired" as a final verdict, since your wallet app cannot tell when a sweep happens. Before a sweep those words are false. A user who reads them stops trying, which turns a recoverable balance into a real loss.

## Surface the dust floor before the user hits it

A refresh needs no on-chain bitcoin. It does need a minimum size. Bark takes the refresh fee out of the refreshed amount. The new VTXO must still be at least 330 sats after the fee. Bark refuses to build a smaller refresh. The Ark server rejects any round output below that floor.

Bark also refuses to start an emergency exit for a VTXO under 330 sats. A wallet whose entire Ark balance sits below the floor can therefore neither refresh nor exit it. Get the user past it in two steps:

1. **Add bitcoin first:** The user receives more over Ark or Lightning, or [boards](https://second.tech/docs/learn/board.md) on-chain bitcoin. A board has its own server minimum (`min_board_amount_sat` in the Ark server info) and an on-chain fee to confirm.
2. **Refresh the old VTXO together with the new sats:** A refresh combines all its inputs into one output, so a refresh that includes both clears the floor. Make that combined call from your app ([refresh an explicit list](https://second.tech/docs/patterns/refresh-fees.md#refresh-an-explicit-list-when-you-want-no-bundling)). The maintenance pass selects each VTXO on its own merits, so it usually leaves a healthy top-up out.

Tell the user as soon as the Ark balance (`spendable_sat` plus `needs_refresh_sat`) falls below the floor plus the refresh fee. Show it in the balance view itself, not as the error message of a refresh that already failed.

Three habits keep users from ever seeing this state: a daily maintenance pass, delegated refreshes on mobile, and a notification ahead of the [next required refresh height](https://second.tech/docs/patterns/maintenance.md#expose-the-next-refresh-deadline).

> [accordion] How Bark Wallet does it
>
> * **Expiry labels:** The [VTXOs page](https://second.tech/docs/bark-wallet/vtxos.md) shows each VTXO's expiry height with a relative label beneath it ("in \~3 days"). It lists live VTXOs first, soonest expiry first, then exited and spent ones, which stay hidden until the user turns them on in the **Filter** menu. The label becomes "Expired" once the tip reaches the height.
> * **Auto-refresh:** The auto-refresh selects every spendable VTXO at or below the threshold that is not already in a round, expired ones included. The app therefore retries the refresh of an expired VTXO on its own ([maintenance](https://second.tech/docs/patterns/maintenance.md) covers the check).
> * **Round badges:** While a VTXO is committed to a refresh, its status badge reads "Queued" until the round starts and "Refreshing" while it runs.
> * **Expired state:** The VTXOs page labels an expired VTXO "Expired". The balance card shows its amount in a "Needs refresh" row.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.