Skip to main content
A virtual output reaches Bitcoin finality when it settles in a batch, meaning a commitment transaction that has confirmed on Bitcoin holds it. Until then, the output is preconfirmed and relies on the operator, and you choose when to settle each one.

The Commitment Transaction

The operator gathers many users into one onchain transaction, the commitment transaction, which every participant signs. Within it, outputs are swapped atomically in three flows:
  • Boarding (onchain to virtual): onchain outputs become virtual outputs.
  • Renewal (virtual to virtual): existing virtual outputs are swapped for fresh, settled ones. This is a batch swap.
  • Offboarding (virtual to onchain): virtual outputs become onchain outputs, with the operator cosigning.

Batch Swaps

A batch swap moves preconfirmed virtual outputs to Bitcoin finality, and there are three reasons to settle:
  1. Trust. Preconfirmed outputs rely on the operator. Settled outputs do not.
  2. Exit cost. Long transaction chains make unilateral exit more expensive. Settlement resets the chain.
  3. Expiry. A batch swap gives virtual outputs a new expiry, and the SDK runs one automatically before their batch expires.
Because the swap is atomic, users keep custody throughout.

How Batch Swaps Work

1

Register

Each user submits a batch registration request that lists the virtual outputs to swap and the scripts and amounts of the new ones. The request also carries the user’s cosigner keys for the new batch’s transaction tree.
2

Build the commitment transaction

Next, the operator builds the commitment transaction, with a batch output for all participants’ new virtual outputs and a connector output that makes the swap atomic.
3

Sign the virtual transaction tree

The operator builds the tree of virtual transactions that splits the batch output into each participant’s virtual output. Using MuSig2, the participants and the operator then check the tree and sign it together.
4

Sign forfeit transactions

Each user signs a forfeit transaction for each old virtual output. Because it spends both the old virtual output and a connector output, the operator can claim the old output only if the new commitment transaction confirms.
5

Broadcast

Finally, the operator signs and broadcasts the commitment transaction. Once it confirms, the new virtual outputs are settled, and the forfeit transactions protect the operator from claims on the old ones.

Batch Anatomy

Depending on the batch, a commitment transaction can have these outputs:
  • Batch output. Holds all participants’ new virtual outputs in a virtual transaction tree.
  • Connector output. An output of the operator, present when users give up virtual outputs. It splits into a tree of dust-amount connectors, one for each virtual output that needs a forfeit transaction.
  • Onchain outputs for offboarding, and the operator’s change.
Offboarding uses connector outputs too: the user forfeits virtual outputs and receives an onchain output of the same commitment transaction. Forfeit transactions make the swap atomic. A forfeit transaction needs a connector output of the new commitment transaction, so the old virtual output passes to the operator only if the new batch confirms:

Batch Registration Requests

Users join a batch by submitting a batch registration request to the operator, whether they are boarding, renewing, or offboarding. The request lists the inputs the user gives up and the exact outputs they expect to receive. To prove ownership of each input, the request carries a BIP322 signature. An input can be a virtual output, an onchain output, or an expired virtual output.