Skip to content

Emergency exit#10

Merged
Jeezman merged 3 commits into
mainfrom
emergency-exit
Jun 13, 2026
Merged

Emergency exit#10
Jeezman merged 3 commits into
mainfrom
emergency-exit

Conversation

@Jeezman

@Jeezman Jeezman commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Emergency exit

Adds an offline unilateral-exit recovery flow: if the Ark server (ASP) becomes unreachable, a user can still recover their funds by broadcasting their pre-signed exit tree to Bitcoin directly and sweeping the resulting on-chain outputs — no ASP cooperation required. Also bumps the ark SDK v0.9.0 → v0.9.2 and refactors the settings screen.

What's included

Offline recovery core

  • Cache the pre-signed unilateral-exit tree per VTXO while connected, so it can be broadcast later without the ASP. The cache snapshots everything the offline path needs (server pubkey, CSV exit delay, dust limit, sweep candidates)
  • unilateral_exit_preflight / _status / _broadcast_next: walk each branch, fee-bump the zero-fee parent via its P2A anchor, and broadcast.
  • Offline sweep: once exit outputs mature past the CSV delay, sweep_unrolled_to_onchain spends them to a regular address. The SDK's send_on_chain requires a live client, so this re-implements the path from ark-core primitives (gap-limit key discovery via esplora, boarding + unrolled VTXO coin selection, local signing) to work fully offline.

Broadcast endpoint

  • Exit packages broadcast through a Bitcoin Core submitpackage endpoint

UI

  • Recovery screen with branch status, CSV countdowns, and the sweep form.
  • Coins screen lists exiting VTXOs, deduped against the spendable list so a mid-exit coin can't be renewed/settled (which would forfeit the exit).

Notes for the reviewer / deploy

  • Releases need two repo settings before the next tag: an AVARK_SUBMITPACKAGE_URL Variable and an AVARK_SUBMITPACKAGE_TOKEN

Jeezman added 3 commits May 21, 2026 12:04
- Cache signed exit trees while the ASP is online so they can be broadcast lindependently.
- Refresh fires in the background on `connect_wallet` and on demand from a new "Emergency exit package" card in Settings, with the cache persisted to
- `unilateral_exit_cache.json` in the app data dir
- Make the wallet UI load even when `connect_wallet` fails (new "offline" connection state) so the recovery card stays reachable when the ASP is down
- Bump ark-rust-sdk v0.9.0 → v0.9.2
- Sweep status and the sweep itself now run offline. The recovery cache snapshots the server pubkey, CSV exit delay, dust limit, and sweep candidates at refresh time; sweeping replicates the SDK's  send_on_chain from ark-core primitives (gap-limit key discovery via esplora, boarding + unrolled VTXO coin selection, local signing)  because the SDK's own path requires a connected client.
- Exit packages broadcast through a configurable submitpackage endpoint
- Exit branches are labelled with their source VTXO and amount; the coins screen lists exiting coins with CSV countdowns, deduped against the spendable list so a mid-exit coin can't be renewed or settled
Release builds can now bake in a default Bitcoin Core submitpackage broadcast endpoint so mainnet unilateral exits work out of the box, while users keep a runtime override. The endpoint resolves as: a Settings override wins, else the compiled-in default, else esplora.
@Jeezman Jeezman merged commit 1b74f91 into main Jun 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant