Skip to main content
With offchain execution, you hold funds as virtual outputs, each a Bitcoin output that you own and spend on its own. A transaction spends existing virtual outputs and creates new ones. Because transactions that spend different virtual outputs don’t depend on each other, they execute in parallel. Each virtual output is the output of a virtual transaction, a complete, presigned Bitcoin transaction that nobody has broadcast. “Virtual” means only that: if you did broadcast it, it would create an output that only you can spend. In normal operation nobody does, and the transaction is there so that you can claim your funds onchain if the operator is unavailable. In the SDK, a virtual output is called a Vtxo, as in getVtxos().

Virtual Output Structure

A virtual output is a Taproot output whose default script has two spending paths, with the key path disabled:
  • Collaborative path. The owner and the operator sign together. Every offchain transaction uses this path, so it is instant.
  • Exit path. The owner spends alone after a delay. If the operator is unavailable, this path lets the owner claim the funds onchain without it. This is unilateral exit.
The delay on the exit path protects the operator. Suppose a user tried to claim onchain a virtual output they had already given up in a batch swap. The delay gives the operator time to broadcast the forfeit transaction first.

Batch Outputs

Virtual outputs don’t each take an onchain output. Instead, a commitment transaction creates one shared output, the batch output, that holds the virtual outputs of every user in the batch. The batch output is a Taproot output with two ways to spend it:
  1. Key path. A MuSig2 key of the operator and the cosigner keys of the batch’s participants. They use it to presign the virtual transaction tree below.
  2. Sweep path. The operator alone can spend the batch output after the batch expires. See Batch Expiry.

Virtual Transaction Tree

A tree of presigned virtual transactions splits the batch output into virtual outputs. Starting from the batch output at the root, each level splits its input into smaller branches until the leaves, which are the individual virtual outputs. Each branch can also be spent by its own subset of keys (A+B+S, C+D+S), down to each virtual output with its own exit path: To exit unilaterally, a user broadcasts only the transactions on the path from the batch output to their own virtual output, so other users’ virtual outputs stay valid.

Virtual Output States

The operator can also allow virtual outputs below Bitcoin’s dust limit. Such a sub-dust output can’t be spent offchain or exited onchain on its own. It can only join a batch, together with other outputs that bring the total above the dust limit.