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

# Choose a refresh option

> Pick between interactive, delegated, and scheduled delegated refresh on liveness, signing, trust, fees, and what happens if the wallet app never returns.

Your wallet app has to refresh every VTXO before it expires. Your users are not always online when a refresh falls due.

## Compare the refresh options

| Option | When the wallet app must be online | Who signs during the round | Fee |
| - | - | - | - |
| Interactive refresh | For the whole round. Once more, after the round transaction confirms, to complete. | The wallet app, with its own keys. Trustless once the app completes the refresh. | The server's schedule, priced at the current chain tip. |
| Delegated refresh | Once to submit. Once more, before the old VTXOs expire, to complete. | The Ark server, on the app's behalf. The app verifies the result and signs forfeits when it returns. | The same schedule, priced when the app submits. |
| Scheduled delegated refresh | Once to submit, any time ahead. Once more later to complete. | Same as delegated. | The same schedule, priced at the scheduled height, usually a cheaper bracket. |

![Diagram of when the wallet app must be online for an interactive, a delegated, and a scheduled delegated refresh](https://mintcdn.com/second-0659a37d/tQnT1N_qr7W8s6kQ/images/refresh-options-online.svg?fit=max\&auto=format\&n=tQnT1N_qr7W8s6kQ\&q=85\&s=9c713e619297709c3b899fced9a53d06)

An interactive refresh needs the wallet app online through the round, a delegated one only while it submits, and every option needs it back online before the old VTXOs expire

All three settle in the same [rounds](https://second.tech/docs/learn/rounds.md) and follow the same fee schedule ([show refresh fees](https://second.tech/docs/patterns/refresh-fees.md) walks through the brackets). Delegating changes who signs during the round, not what the refresh costs. If the wallet app never returns, the outcome differs:

* **Interactive:** The participation stalls, a later maintenance pass cancels it, and the refresh starts over in a new round. Nothing is refreshed. The pass does not cancel a participation whose round already finished. The next sync after the round transaction confirms completes it.
* **Delegated and scheduled:** The server carries the round once. A round that skips the participation, for example a full one, leaves it for the next round. The new VTXO stays hash-locked until the app returns and forfeits the old VTXOs. Make the app return before those expire, while an emergency exit on them can still confirm.

## Refresh interactively when the app stays online

Pick interactive refresh for any wallet app that can keep its process alive across a round. That includes a server-side integration, a node, a desktop app, or a browser tab the user is looking at. It is the default on every surface.

> [tab] Bark SDK
>
> Call `maintenance()` to run the full pass and join the next round with every VTXO that is due, or `refreshVtxos(vtxoIds)` to refresh a chosen set. When there is something to refresh, both calls wait for the next round to start, then take part in it until the round ends. The wallet app completes the refresh on a later sync, once the round transaction confirms.

> [tab] Bark CLI
>
> Run `bark maintain`, or `bark refresh` with a selection (`--vtxo`, `--all`, `--threshold-blocks`, `--threshold-hours`).

> [tab] Barkd
>
> The background daemon joins rounds on its own while `barkd` runs. `POST /api/v1/wallet/refresh/vtxos` and `POST /api/v1/wallet/refresh/all` trigger one by hand.

Keep the process alive from submission until the round ends ([scheduled maintenance](https://second.tech/docs/patterns/maintenance.md#stay-online-through-round-participation) covers what each surface needs).

## Delegate the round when the app cannot stay online

Pick delegated refresh when the operating system can suspend your app mid-round, which is the normal case on iOS and Android, and an option on desktop. The Ark server signs the round on the app's behalf ([delegated refreshes](https://second.tech/docs/learn/rounds.md#delegated-refreshes) walks through the phases).

> [tab] Bark SDK
>
> Call `maintenanceDelegated()` for the full pass, or `refreshVtxosDelegated(vtxoIds)` for a chosen set (same names in Swift, Kotlin, React Native, and Dart). The latter returns the participation's round state, or nothing when there is nothing to refresh.

> [tab] Bark CLI
>
> Run `bark maintain --delegated`, or `bark refresh --delegated` with a selection.

> [tab] Barkd
>
> Call `POST /api/v1/wallet/refresh/delegated/vtxos` with the VTXO IDs.

Plan for the gap between submission and completion:

* **The old VTXOs stay spendable until the server issues the round:** A send that picks one in that window makes the server drop the participation. On a later sync the app submits a new delegated participation with the inputs that remain. The refresh movement carries on with it. If no input remains, the app marks the refresh movement `failed` and drops the participation. It does the same when the remaining inputs cannot cover the refresh fee and leave a non-dust output. In those two cases, submit a new participation. In every other case, the app completes the refresh on the first sync after the round transaction confirms. Until then, `pendingRoundStates()` lists the participation as `delegated-pending`.
* **The user trusts the server for as long as they hold the new VTXO:** [Delegated co-signer](https://second.tech/docs/patterns/delegated-cosigner.md) covers what the server can do meanwhile and what the app checks before it forfeits.
* **A mobile app needs background wakes:** [Background refresh](https://second.tech/docs/patterns/background-refresh.md) covers waking the app, running the delegated pass, completing each refresh on a later wake, and storing the mnemonic.

## Schedule a delegated refresh ahead of time

Pick a scheduled delegated refresh when the app has the user's attention now and may not have it when the refresh is due, typically during a foreground session on mobile. The app submits the participation with a future block height. The server holds it out of rounds until the chain tip reaches that height.

> [tab] Bark SDK
>
> Call `refreshVtxosScheduled(vtxoIds, scheduledHeight)`. `pendingRoundStates()` shows the participation as `delegated-pending` (a `RoundFlowKind` case in the native SDK bindings) with the height in `scheduledHeight`.

> [tab] Bark CLI
>
> Run `bark refresh --delegated --height <height>` with a selection. `bark round list` shows the participation with its `scheduled_height`.

> [tab] Barkd
>
> Call `POST /api/v1/wallet/refresh/delegated/vtxos` with `height` set. `GET /api/v1/wallet/rounds` shows the participation with its `scheduled_height`.

Schedule it at least 144 blocks (about a day) before `expiry_height`, the same margin as the default refresh threshold, rather than on the last possible block:

* **Fee:** The server prices the refresh at the scheduled height and locks that price in at submission. Scheduling close to expiry pays the lower bracket the VTXO would reach by then.
* **Height limit:** The server refuses a height at or past any input VTXO's `expiry_height`. A round has to happen between the scheduled height and expiry.

> [accordion] How Bark Wallet does it
>
> * **Installed version, interactive:** The `barkd` daemon does the upkeep. The app's auto-refresh and "Refresh all" action submit interactive refreshes through `POST /api/v1/wallet/refresh/vtxos` and `/refresh/all`.
> * **Web version (WASM), delegated:** The same actions submit delegated refreshes through the SDK's `refreshVtxosDelegated`. The worker's sync loop completes them the next time a tab is open. While a tab is open, the bark library's background daemon can also join a round interactively for the VTXOs its maintenance selection finds due. [Maintenance](https://second.tech/docs/patterns/maintenance.md) covers how the app runs its refresh check.


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