Skip to main content
Design patterns are opinionated answers to the problems every wallet app built on Bark runs into. Each pattern page states one problem, gives the solution with concrete examples, and shows how Bark Wallet, Second’s reference wallet app, handles it.

Keep bitcoin recoverable

Backups

The mnemonic alone recovers a balance only with the server’s cooperation. Back up the wallet database continuously to restore everything without it.

Mnemonic storage

Bark never stores the mnemonic for an SDK app. Store it in each platform’s secure storage, or encrypt it in the browser, preferably with a user password.

Restore

A user reinstalls or changes devices. Restore from the mnemonic or the database backup, and tell them what came back.

Keep VTXOs alive

Maintenance

VTXOs expire if nobody refreshes them. Keep Bark’s background daemon running so it refreshes them in time.

Refresh fees

A maintenance refresh can charge a fee users never asked for. Show it on the movement and label it honestly.

Refresh options

Users are not online when a refresh is due. Pick between interactive, delegated, and scheduled delegated refresh on liveness, trust, and fees.

Background refresh

iOS and Android suspend a mobile app shortly after the user leaves it. Wake it every few hours and run one delegated pass per wake.

Delegated co-signer

A delegated refresh runs without the user. Know who they trust while they hold its VTXO, and what a wallet app can recover afterwards.

Show the wallet truthfully

Balances

A single number misleads. Show one stable total with labeled pending slices, and never render an unknown amount as zero.

Expired VTXOs

Refreshes get missed. Show users what expired and what they can still recover instead of a silently shrinking balance.

Payment flows

Payments settle at different speeds per rail. Detect the rail and track each payment until it settles.

On-chain payment source

An on-chain address says nothing about which balance pays. Pick one selection design and apply it to every on-chain send.

Get bitcoin back on-chain

On-chain payments

The server cooperates. Your app pays an on-chain address or offboards the balance in one transaction: estimate the fee, send, track.

Exit handling

The server stops cooperating. Your app moves bitcoin back on-chain without it: start, fund, progress, claim.

Forced exits

A user’s VTXO can land on-chain without the user asking. Detect it during sync, fund the exit, and claim the bitcoin.

Before you launch

Production checklist

Verify every duty on your own app before you go live: backups restored, refreshes scheduled, balances honest, exits funded.

Brief your coding agent

Hand this prompt to your coding agent so the duties make it into your implementation plan.

Paste this prompt into your coding agent.

Open in Cursor