Skip to main content
Your wallet app has to bring a user’s wallet back after a reinstall or a change of device.

Compare what each restore path brings back

Backups explains how both backups are made. This table is what each one gives back. A database backup restores the wallet as of its last snapshot:
  • Incoming Ark payments and delegated refresh outputs after the snapshot: Come back through the regular mailbox sync.
  • Other VTXOs the wallet itself created after the snapshot, such as the change of a send or the output of an interactive refresh (current limitation): Log them as the wallet creates them. Bring them back after the restore. On the SDK, log their IDs and pass them to recoverVtxos. On Barkd, log each VTXO’s encoding, which GET /api/v1/wallet/vtxos/{id}/encoded returns. After the restore, send it to POST /api/v1/wallet/import-vtxo. On the Bark CLI, bark raw-vtxo <VTXO_ID> prints that encoding. Pass it to bark dev vtxo import. A fresh mnemonic restore also brings them back, at the cost of the history.
  • VTXOs spent by a payment after the snapshot (current limitation): Still count in the balance. Present the restored balance as the balance at the snapshot (tell the user what came back).
  • Either path: Needs a reachable chain source to open.

Pick the path from what the user still holds

  • The old install is still reachable (a change of device): Move the wallet with the steps below. Restore from the mnemonic only when your app has no way to import a database, and tell the user what that path does not bring back.
  • The old install is gone (a lost or wiped device): Restore from the latest continuous backup if the app ran one. Otherwise restore from the mnemonic and tell the user what that path does not bring back.
To move a wallet to a new device:
  1. Let the old install finish syncing.
  2. Stop its background daemon. On the SDK, await stopDaemonWait() (stop_daemon_wait in Rust). In a browser that call only signals the stop, so let any sync pass in flight finish before you copy.
  3. Copy its wallet database.
  4. Delete the old install. On Barkd, DELETE /api/v1/wallet deletes it once you pass dangerous: true and the wallet’s fingerprint.
  5. Restore on the new device from that copy. It brings back the history and every in-flight state, and needs nothing from the server.
Never run two wallet apps on the same mnemonicEach instance refreshes and spends VTXOs the other never learns about. Bitcoin the surviving instance cannot see is lost when those VTXOs expire. Delete the old install before restoring on the new one.

Restore from the mnemonic

Create the wallet from the existing mnemonic instead of a fresh one. That first open starts the recovery scan, which rebuilds the spendable Ark balance. The scan asks the Ark server for every VTXO held by the wallet’s keys, then reads the wallet’s mailboxes.
Open the wallet for the first time with the existing mnemonic, leaving createIfNotExists at its default of true. In Go, set CreateIfNotExists: true explicitly, since an unset bool field is false. The create-if-missing path is what runs the recovery scan, so restore through open, not through a separate create (initWallet in the native bindings). Leave the open option skipRecovery (skip_recovery in Rust) at its default of false.Call initialScan (initial_wallet_scan on the Rust on-chain wallet) once after the restore to bring the on-chain balance back:
  • With a bitcoind chain source: Pass a birthday height, a block height from before the wallet’s first transaction, or the scan starts at the genesis block.
  • With Esplora: The scan is a gap-limited full scan and needs no height.
  • With your own callback on-chain wallet: Run your own history scan instead of initialScan.
Raise the key gap limit before the restore if your wallet app hands out many addresses that never receive bitcoin. The server’s xpub lookup does not use that limit. The mailbox scans match a VTXO only when its key sits within vtxoKeyGapLimit consecutive unused key indices (vtxo_key_gap_limit in Rust and config.toml, --gap-limit on bark create, gap_limit on POST /api/v1/wallet/create). They put a VTXO beyond that window in foreign. The limit is 250 by default and 100,000 at most. Every match extends the window. On the SDK, read recoveryStatus once the wallet is open (the Rust crate hands the same RecoveryStatus to the on_recovery_finished callback of OpenWalletArgs). The values below are the TypeScript tags for web apps. The other bindings expose the same four cases in their own casing: recoveryStatus and recoveryReport describe the scan as the open saw it and do not change afterward. recoveryReport is present only when the status is in-progress or completed, so read the status first. While a scan is in progress, read pendingRecovery() after each sync and store its failed and abandoned IDs, so your app still has them once the scan is done. The buckets:
  • recovered: What came back.
  • failed: Entries the scan could not decide yet. They may still hold bitcoin. Each full sync retries them, so a completed report has none.
  • abandoned: Entries the scan gave up on after 40 attempts that the server or the chain answered without a decision. They may still hold bitcoin, so retry them with recoverVtxos(vtxoIds).
  • foreign: Entries whose key sits beyond the key gap limit. Retry them with recoverVtxos(vtxoIds, gapLimit) and a wider limit, up to 100,000.
  • skipped, exited, and notFound: No retry. skipped holds VTXOs already spent, unclaimed, or unregistered. exited holds VTXOs whose exit transaction is already confirmed, handed to the exit process, so progress and claim them like any other emergency exit. notFound holds IDs the Ark server does not know.
  • isComplete: true only when failed, abandoned, and foreign are all empty.
Barkd and the CLI run the same scan. Read its outcome in their log. A scan that could not start logs an error saying bitcoin may be missing. A scan that stopped before the end logs a warning with the number of VTXOs still missing. On the CLI, any command that syncs resumes it. On Barkd, each start of barkd and each POST /api/v1/wallet/sync resume it.

Restore from a database backup

Put the backed-up wallet database back where the wallet reads it, then open with the same mnemonic. The wallet opens as an existing wallet, so no recovery scan runs. Its next sync continues the pending boards, rounds, and Lightning payments from the state in the snapshot.
Restore the persisted store before the first open. That store is db.sqlite in the directory you pass as datadir on iOS, Android, and desktop, or the IndexedDB data your web app shipped out. Then open the wallet with the mnemonic as usual.

Tell the user what came back

Show the recovered balance as soon as the wallet opens, and be explicit about what the path did not bring back.
  • After a mnemonic restore: Show the Ark balance right away and the on-chain balance once the chain scan completes. Treat a failed or in-progress recovery status, and any failed, abandoned, or foreign entry of the report, as bitcoin that may still be missing. Say that the payment history starts at the restore, and name any board or Lightning payment that was in flight instead of promising the amount will appear.
  • After a database restore: Show the balance and history as they were at the last snapshot. An in-progress exit resumes from the database state. Run the exit automation from exit handling on the restored wallet.
  • From the mnemonic: Bark Wallet’s welcome screen offers Import existing wallet, which calls POST /api/v1/wallet/create (Restore your wallet walks users through it). The web version (WASM) opens the SDK wallet with the mnemonic, calls initialScan for the on-chain history, and warns the user if that scan fails.
  • From a database backup: Each platform brings the wallet directory or the latest snapshot back its own way (Restore a continuous backup covers Start9, Umbrel, and self-hosted installs).