Splitting coins
How do you split a coin that never moves?
Off chain, splitting a coin means pre-signing a transaction that divides one output into several, and giving each piece its own way to be signed for. Spark splits the key along with the value, so the pieces add back up to the original key and can be merged again. Ark splits value in its round trees and in out-of-round payments. Statechains and Mercury Layer don’t split at all.
- Arkade
- Any number of outputs per off-chain payment, through a checkpoint9
Why splitting is hard off chain
On the blockchain, splitting a coin is trivial: spend it in a transaction with several outputs. Off chain, the coin is not supposed to move, and every piece of it still needs everything a whole coin needs: a transaction, signed in advance, that its owner can broadcast alone, and a way for the piece to change hands without touching the others.
So a split always adds a pre-signed transaction between the on-chain coin and each piece. That makes every piece’s exit path longer, and exits cost one on-chain fee per transaction. How a system splits decides how deep its coins get, how small they can usefully be, and whether the split can be undone.
A statecoin can’t be split at all: the whole design is one output with one shared key. Somsen’s answer to odd amounts was to swap coins with other users, and Mercury Layer offers atomic swaps of whole coins for the same reason.1,2
Spark: splitting a leaf
Spark splits with an operation its operators call tree creation: the owner proposes a tree of new nodes under an existing output, the operators check it and help sign it, and the old leaf is marked as split.3 The interesting part is the keys. Each piece needs its own key pair between the owner and the operators, and Spark derives them so that nothing is lost and nothing new needs to be trusted.
In symbols, for a leaf with owner secret u and operator secret s split into n children:
The operators never compute s or any sᵢ. Each operator holds a Shamir share of every key, and shares add: subtracting its shares of s₁ … sₙ₋₁ from its share of s gives it a valid share of sₙ. The code checks the result against the public keys before storing it.4 The fresh keys come from a pool of keys the operators generate in advance, a thousand at a time.5
Before signing, every operator checks that each output of the split transaction pays a child address prepared for the same owner, that the owner’s child keys add up to the owner’s key for the parent, and that the operators’ child keys add up to theirs; a request that fails either sum is rejected.3 The “direct” twin of the split transaction must pay the same scripts in the same order, each value reduced by the fixed 955-sat fee.3,7
The on-chain logic
A split adds two transactions to every child’s exit path. Before it, a leaf’s way out is its node transaction and its refund. After it, the path is the parent’s node transaction, the split transaction, the child’s node transaction and the child’s refund.3
The split transaction spends the same output as the parent leaf’s old refund. The two conflict, and the old refund is still a valid signed transaction. What keeps the children safe is the same rule as for transfers: the refund waits behind a relative timelock, so a split transaction that can confirm sooner wins. In the renewal code, the split transaction carries no timelock at all.8
Values are chosen by whoever builds the tree. Bitcoin itself enforces that the outputs don’t exceed the input; the operators check scripts and keys. Spark’s wallets work with leaves in powers of two, from 1 sat to 227 sats.12
Spark: who splits, in practice
Wallets mostly don’t split their own leaves. In the JavaScript SDK, a deposit creates a single leaf: the deposit output, a root node transaction and a refund.13 When a payment needs an amount the wallet’s leaves can’t make, the wallet swaps leaves with the Spark Service Provider, which hands back leaves in the denominations needed.12 The operator code refers to the provider’s own tree-building code, which is not public, when it explains which transaction shapes it accepts.3 In other words, the SSP is where most splitting happens; the Spark chapter shows the swap from a wallet’s point of view.
Spark: merging leaves back
Additive keys make splits reversible. If one owner holds every leaf under a node, the sum of those leaves’ keys equals the node’s own key, so the owner and the operators can sign for the node directly. The operator code includes an aggregate leaves flow that does exactly that: it signs, under the summed key, a transaction that spends the same output the node’s own transaction spends and pays it straight to the owner with no timelock, plus a version a watchtower can broadcast that waits 50 blocks and pays its own fee. The leaves below are retired, and up to 256 can be merged at once.6
Two caveats. The operators’ side of the summed key has to be rotated as well, since each leaf’s operator share changed every time the leaf was transferred; the code rotates the node’s key share to the sum of the leaves’ shares when the merge commits.6 And at the commit cited here, the JavaScript SDK does not yet call this flow, so treat merging as new.6
Ark: splitting a VTXO
In a round, splitting is the whole point: the round output is divided by a tree of pre-signed transactions until everyone has a leaf, each output locked to the MuSig2 key of everyone below it plus the operator. Arkade’s trees split in two at each level; bark’s in up to four.14,15
Out of round, a payment splits a VTXO into the recipient’s part and the change. Both implementations now insert a checkpoint transaction between the old VTXO and the new ones, but they shape it differently.
Arkade builds one checkpoint per input and one Arkade transaction that spends all of them; it refuses to build anything unless inputs equal outputs to the sat, and adds a zero-value anchor to both each checkpoint and the Arkade transaction so their fees can be paid by child transactions. The smallest allowed VTXO defaults to the dust limit.9,16
bark lets one arkoor payment spend exactly one VTXO, so paying more than any single VTXO holds means several packages. The checkpoint has one output per destination, and the template server allows at most four outputs per input. Amounts below twice the dust limit get special treatment: they are carried by one combined checkpoint output into a separate dust isolation transaction, so a tiny payment never shares a transaction with large change. In Second’s example, paying 160 sats from a 100,000-sat VTXO gives a checkpoint with 99,670 sats of change and 330 sats for the isolation transaction, which then pays 160 to the recipient and 170 back as dust change.10,11
An ordinary out-of-round hop adds two transactions to the exit path, plus one more for bark’s dust isolation when needed, and bark’s template server stops co-signing once a VTXO’s path reaches 100.11,17 In Ark, refreshing in a round is how a deep, much-split VTXO becomes a shallow one again.
What splitting costs on chain
Nobody pays for splits while everyone cooperates. They matter on the way out: leaving alone means broadcasting every transaction on the path, each with its own fee. Count the transactions, multiply by their size and the fee rate, and you have a rough floor below which a coin is not worth taking out alone. Spark’s SDK uses 191 vB as its estimate for one tree transaction, which is the default below.7
Side by side
| Spark | Arkade | bark | |
|---|---|---|---|
| Where splits happen | Tree creation under an existing output; mostly by the SSP | Round trees; off-chain payments | Round trees; arkoor payments |
| Keys for the pieces | New key pairs, additive: children sum to the parent | Each output gets the recipient’s VTXO script | Each output gets the recipient’s VTXO policy |
| Extra transactions per split | 2 (split + child node transaction) | 2 per hop (checkpoint + Arkade transaction) | 2 per hop (checkpoint + arkoor), 1 more for dust isolation |
| Limits | Power-of-two denominations in the SDK | Inputs = outputs; dust minimum | 1 input, ≤ 4 outputs per input; depth ≤ 100 |
| Undoing it | Merge leaves back into their node (aggregate leaves) | Refresh in a batch | Refresh in a round |
The precise version
Spark key derivation. validateAndCountTreeAddressNodes requires the children’s user public keys to sum to the parent’s. applyKeysharesToTree walks the tree breadth first; for each node with n children it assigns n − 1 fresh keyshares and calls CalculateAndStoreLastKey, which computes last = target − Σ selected on the secret share, the public key and every operator’s public share, verifying the result before storing it. Each child’s address is P2TR(Sᵢ + Uᵢ).3,4
Spark split validation. For a node with children, the CPFP node transaction’s outputs, excluding a trailing zero-value anchor, must match the children one to one, each paying a prepared address owned by the same identity; the user keys and the operator keys must each sum to the parent’s. The direct twin must have the same scripts in the same order and pay each CPFP value minus DefaultFeeSats (191 vB × 5 sat/vB = 955). A leaf has a single-output node transaction and a refund. The parent is then marked SPLITTED.3,7
Spark aggregation. The target node must branch into two or more chains of one-child renewal nodes, each ending in exactly one requested leaf, so the leaves are provably the complete set. The exit package is a refund spending the target’s defining outpoint with no timelock, paying the full value to P2TR(Σ user keys) with an ephemeral anchor, and a watchtower refund with relative timelock DirectTimelockOffset (50) and the default fee deducted. Both are signed under the in-memory sum of the leaves’ keyshares, which must share one threshold and one operator set; at most 256 leaves per call.6
Arkade. BuildTxs(vtxos, outputs, signerUnrollScript) builds a checkpoint per VTXO whose output tree holds the signer’s CSV closure and the VTXO’s own collaborative closure, then an Arkade transaction (version 3) spending the checkpoints with the requested outputs plus an anchor, failing if input and output sums differ.9
bark. ArkoorBuilder takes one input VTXO, normal outputs (one checkpoint output each) and isolated outputs (each below twice P2TR_DUST, combined into one checkpoint output that an isolation fanout transaction splits). It needs one signature for the checkpoint and one per arkoor transaction, each a MuSig2 of user and server, with the server signing first.10
Where this explanation stops
- The Spark figure leaves out signing: FROST rounds for the operators, the owner’s partial signatures and the key-tweak messages.
- The SSP’s tree-building code is not public, so how it chooses tree shapes and denominations is not described.
- Renewal can add node transactions to a leaf’s path; the transaction counts above are minimums.
- The exit-cost calculator is a rough model, not a fee estimate.
Sources
Pinned commits: buildonspark/spark@0b3a32a, arkade-os/arkd@f863e48, ark-bitcoin/bark@04c5545.
- Ruben Somsen, “Statechains”, Scaling Bitcoin, Tokyo, 2018. Transcript.
- Mercury Layer, “Atomic transfer protocols”. docs/atomic_transfer.md.
- Spark tree creation: key-sum checks and address preparation (spark/so/handler/tree_creation_handler.go, lines 296–540); split validation (lines 940–1045); parent marked split (lines 1171–1200); the SSP reference in lines 171–177.
- Last keyshare derivation: spark/so/ent/signingkeyshare_extension.go, lines 1365–1425.
- Pre-generated keyshares,
DKGKeyCount = 1000: spark/constant.go, lines 9–10. - Leaf aggregation flow: spark/so/handler/aggregate_leaves_flow_handler.go (design notes in its comments).
- Default fee for direct transactions, 191 vB × 5 sat/vB: spark/common/bitcoin.go, lines 30–44.
- Renewal with a zero-timelock split node transaction: spark/testing/wallet/renew.go, lines 176–200.
- Arkade off-chain transactions and checkpoints: pkg/ark-lib/offchain/tx.go, lines 31–235.
- bark arkoor and dust isolation: lib/src/arkoor/mod.rs, module documentation; ArkoorBuilder (lines 336–390); docs/checkpoints.
- bark server template:
max_arkoor_fanout = 4,max_vtxo_exit_depth = 100. server/captaind.default.toml, lines 38–46. - Spark SDK leaf selection and denominations: services/leaf-manager.ts; utils/optimize.ts, line 3.
- Spark SDK deposit, a single root node and refund: services/deposit.ts, lines 246–451.
- arkd tree radix: pkg/ark-lib/tree/builder.go, lines 20–21.
- bark tree radix: lib/src/tree/mod.rs, lines 6–7.
- arkd minimum VTXO amount default: internal/config/config.go, lines 287–288.
- bark exit depth test vectors: lib/src/vtxo/mod.rs, lines 1622–1642.
- Spark documentation, “Unilateral exit”.
Checked 10 October 2026.