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