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 upstorage and an EventSource as in the
Node.js example.
Your wallet needs enough available funds to cover the payment and fees. See
Receive Payments to add funds.
Sending to Arkade Addresses
Use thesend function with an Arkade address, starting with 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 Arkade Assets, add anassets array to the recipient. Asset amounts are bigint values in base units:
amount, the recipient’s output holds the dust amount of BTC.
Send with BTC
Add a BTCamount, in satoshis. The recipient receives the BTC and the asset on the same virtual output:
Send Multiple Assets
Add more entries to theassets array to send several assets in one transaction:
Send All Units
Read the spendable amount fromavailableAssets, 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
Request a solver quote, verify its terms, and fund the payment. Failed payments follow the committed refund path after the deadline.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), use the Ramps class for
collaborative withdrawal. The SDK selects eligible Arkade outputs and requests
a conventional Bitcoin output at the destination.
Offboarding (Collaborative Exit)
Batched withdrawal with
Ramps.Finalizing Pending Transactions
CallfinalizePendingTxs() after interruption or reconnect: