Skip to main content
Your wallet app gets bitcoin from the Ark balance to an on-chain address in a single transaction that the Ark server signs. Reserve emergency exits for a server that does not cooperate.

Choose between an on-chain payment and an offboard

Both forfeit VTXOs to deliver an on-chain output to one address. Pick the one that matches what the user asks for: An offboard of the entire balance also takes the VTXOs in needs_refresh_sat, which an Ark payment cannot spend (balances covers that field). Neither call needs an on-chain balance, since the fee comes out of the Ark balance.

Estimate the fee before the user confirms

The Ark server sets the on-chain payment fee. It depends on the amount, the remaining lifetime of the VTXOs, the current feerate, and the destination’s address type. Ask Bark for an estimate:
  • estimateSendOnchainFee(address, amountSats) prices an on-chain payment.
  • estimateOffboardAllFee(address) prices an offboard of the entire balance.
  • estimateOffboardFee(address, vtxoIds) prices an offboard of chosen VTXOs.
Each call returns grossAmountSats, feeSats, netAmountSats, and vtxosSpent.
Build the confirmation screen from the estimate:
  • Show the total next to the fee: For an on-chain payment, the gross amount leaves the Ark balance and the recipient receives the net amount. For an offboard, the net amount arrives on-chain.
  • Estimate again when the confirmation screen opens: Bark computes the fee again when the send starts, so the movement can show a different fee from an older estimate.
  • Disable the send action when vtxos_spent is empty: Bark cannot make that on-chain payment. This happens when the Ark balance does not cover it, or when it needs more VTXOs than the Ark server allows in one transaction.
  • Refuse dust before the call: Bark rejects an on-chain payment below the dust limit of the destination’s address type, 330 sats for a taproot address. Refuse an offboard when the estimate’s net amount is below that limit.

Send the payment or start the offboard

  • sendOnchain(address, amountSats) pays an address.
  • offboardAll(address) moves the entire Ark balance.
  • offboardVtxos(vtxoIds, address) moves chosen VTXOs.
Each call returns the txid of the transaction and a movementId.
The call returns when Bark broadcasts the transaction, before any confirmation. The Ark server caps the number of VTXOs in one transaction (max_offboard_inputs in bark ark-info). When an offboard of the entire balance would take more VTXOs than that cap, offboard chosen VTXOs in batches instead.

Track the transaction until it confirms

Drive the screen from the movement that the call returns:
  • Balance: Until Bark broadcasts the transaction, the sats sit in pending_offboard_sat. At broadcast, the sent amount and the fee leave the Ark balance.
  • Status: The movement stays pending until the transaction has enough confirmations, then turns successful. Show it as confirming, with the transaction ID from offboard_txid in its metadata.
  • Confirmations: Bark waits for offboardRequiredConfirmations confirmations (offboard_required_confirmations in Rust and config.toml). The default is 2 on mainnet and 0 on other networks. At 0, the movement turns successful once Bark sees the transaction in the mempool.
  • Sync: Bark checks the transaction during a sync. The bark library’s background daemon syncs on its own. Without it, call sync(). On the CLI, run a command that syncs, such as bark balance.
  • Offboard to Bark’s on-chain wallet: Sync the on-chain wallet as soon as the call returns, so the amount shows as unconfirmed on-chain bitcoin.

Check for a running attempt before a retry

After an error from the call, an attempt can still be running. Sync the wallet, then check in this order:
  1. pending_offboard_sat is above 0: Bark still holds VTXOs for an attempt and continues it on each sync. Do not send again.
  2. A movement of kind send_onchain or offboard, created since the call, is pending or successful: The transaction is on the network. Do not send again.
  3. Neither applies: No attempt is running. A failed movement means that no forfeit took effect and Bark broadcast nothing. Estimate the fee again, then retry.
A second send in the first two cases makes the user pay twice. When pending_offboard_sat stays above 0 through several syncs, read Bark’s log for the reason. A broadcast transaction can also go missing from both the chain and the mempool. Bark broadcasts it again during offboard_lost_tx_grace_period_secs (in Rust and config.toml), one hour by default. After that the movement stays pending and the VTXOs stay locked, because the Ark server can still broadcast the transaction. Show the transaction ID so the user can follow it on a block explorer.
  • On-chain payment: For an on-chain destination, Bark Wallet shows the estimated fee under the amount and a “Pay from” selector that defaults to the Ark balance.
  • History: The on-chain payment appears in the history with its status.
  • Offboard: The VTXOs page offers an “Offboard” action on the selected VTXOs. It pays an address the user pastes, or the wallet app’s own on-chain wallet with “Use my Bark on-chain wallet”.
  • Fee: Bark Wallet deducts the fee from the offboarded amount.