Skip to main content
Send BTC to Arkade users, Lightning invoices, or Bitcoin addresses from one wallet balance, including Arkade recipients who are offline.

Setup

Load the mnemonic you stored when you created your wallet, for example from an environment variable. The snippet connects to mainnet. In Node.js, also set up storage and an EventSource as in the Node.js example.

Sending to Arkade Addresses

Call send with an Arkade address (ark1 or tark1) and an amount in satoshis. The recipient does not need to be online.
send checks the address before it spends anything. It throws if the address:
  • has another network’s prefix: Invalid Arkade address <address>: expected prefix "ark", got "tark"
  • contains an operator public key that the operator doesn’t recognize: Invalid Arkade address <address>: unknown operator signer key
  • contains a retired operator public key after its cutoff date: Invalid Arkade address <address>: operator signer key is past its rotation cutoff

Sending Assets

To send assets, add an assets array to the recipient. Asset amounts are bigint values in base units:
The remaining units stay in your wallet as change. If you omit amount, the recipient’s output holds the dust amount of BTC.

Send with BTC

Add a BTC amount, in satoshis. The recipient receives the BTC and the asset on the same virtual output:

Send Multiple Assets

Add more entries to the assets array to send several assets in one transaction:

Send All Units

Read the spendable amount from availableAssets, then send it:

Choosing Inputs

send picks the virtual outputs to spend. To pick them yourself, for example to fund a contract only from outputs that expire after its timelock, pass selectedVtxos. The wallet spends exactly those outputs and adds none, so they must cover the amount. Pick from getSpendableVtxos({ withRecoverable: false }). getVtxos() also returns outputs that the wallet can’t spend now, such as funds locked in a swap.

Pay a Lightning Invoice

The swap client’s pay gets a solver’s quote, checks it, and funds the payment. If the solver never pays the invoice, the client refunds your bitcoin after the quote’s refundLocktime passes.

Pay Lightning

Quote, funding, and the refund path.

Exchange Assets

Exchange BTC and other assets, with both sides settling through Arkade.

Sending to Bitcoin Addresses

To send BTC to a Bitcoin address (bc1 or tb1), offboard with Ramps. The SDK picks the virtual outputs to spend, and a commitment transaction pays the destination onchain.

Offboarding (Collaborative Exit)

Batched withdrawal with Ramps.

Finalizing Pending Transactions

If a send was interrupted before it finished, for example by a crash or a dropped connection, call finalizePendingTxs() when the app starts again. It returns at once if no send was interrupted:
Pass specific outputs to limit the check: