Critical Requirements:
- Only exit leaves > 16,348 sats (smaller amounts cost more in fees than they’re worth)
- Must complete entire process in single session - wallet unusable until finished
- Transactions must be broadcast from root to leaves in exact order shown
- Bitcoin Core V29 required for ephemeral anchors
- Beta feature: we’re fixing bugs as we find them
Cost Considerations
Unilateral exits are expensive - way more than cooperative exits:- Fee calculation: ~
315 * sats_per_vbyte * (depth+3)
per leaf - Each tree level adds ~1500 sats in fees
- Fees vary with L1 network conditions (currently ~5 sats/vbyte)

- Blue (L1): Final amount returned to you on Bitcoin L1 after completing the unilateral exit.
- Red (Fees): Total BTC fees paid to execute the exit (varies with balance size and tree depth).
- Green (Spark): Gross balance left on Spark after initiating the exit.
Tree Structure Basics
Your Spark funds are organized in a tree:- Each “leaf” = portion of your funds with different values/timelocks
- Deeper leaves = more transactions required to exit
- Broadcasting order matters: root → leaves
Getting Started
1. Check Your Leaves
2. Start Interactive Exit
Important: Use
--testmode=true
ONLY on Regtest. Mainnet users must use
the regular flow without testmode to properly handle timelocks and manual fee
signing.- Leaf selection
- Timelock handling (auto-refreshed in test mode)
- UTXO generation for fees
- Transaction creation and signing
- Broadcast order instructions
Regtest Testing
Test on regtest first - don’t learn on mainnet.Setup
- Initialize wallet and deposit 131,072 sats for testing
- Use regtest faucet (max 50,000 per deposit)
- CLI auto-generates test wallet for fees
Broadcasting
Use https://regtest-mempool.us-west-2.sparkinfra.net/tx/push to submit packages in order. Wait ~1 min between packages for confirmation.Mainnet Usage
Prerequisites
- Sufficient L1 Bitcoin UTXOs for transaction fees
- Only exit leaves > 16,348 sats
- Recommended: 131,072 sats deposit for better leaf sizes
Mainnet vs Regtest
- UTXOs: Provide your own Bitcoin UTXOs when prompted
- Broadcasting: Use
bitcoin-cli submitpackage '["node_tx", "fee_bump_tx"]'
- Costs: Real network fees apply
Process
- Check leaves with
sparkcli getleaves
- Run
sparkcli unilateralexit
(no testmode - you’ll handle timelocks manually) - CLI will walk you through it (bring your own UTXOs)
- Broadcast in exact order shown by CLI