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, whichGET /api/v1/wallet/vtxos/{id}/encodedreturns. After the restore, send it toPOST /api/v1/wallet/import-vtxo. On the Bark CLI,bark raw-vtxo <VTXO_ID>prints that encoding. Pass it tobark 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.
- Let the old install finish syncing.
- Stop its background daemon. On the SDK, await
stopDaemonWait()(stop_daemon_waitin Rust). In a browser that call only signals the stop, so let any sync pass in flight finish before you copy. - Copy its wallet database.
- Delete the old install. On Barkd,
DELETE /api/v1/walletdeletes it once you passdangerous: trueand the wallet’s fingerprint. - Restore on the new device from that copy. It brings back the history and every in-flight state, and needs nothing from the server.
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.- Bark SDK
- Bark CLI
- Barkd
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.
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 acompletedreport 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 withrecoverVtxos(vtxoIds).foreign: Entries whose key sits beyond the key gap limit. Retry them withrecoverVtxos(vtxoIds, gapLimit)and a wider limit, up to 100,000.skipped,exited, andnotFound: No retry.skippedholds VTXOs already spent, unclaimed, or unregistered.exitedholds VTXOs whose exit transaction is already confirmed, handed to the exit process, so progress and claim them like any other emergency exit.notFoundholds IDs the Ark server does not know.isComplete:trueonly whenfailed,abandoned, andforeignare all empty.
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.- Bark SDK
- Bark CLI
- Barkd
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
failedorin-progressrecovery status, and anyfailed,abandoned, orforeignentry 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.
How Bark Wallet does it
How Bark Wallet does it
- 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, callsinitialScanfor 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).