Skip to main content

Transaction Batching

Transaction batching is the foundation of Ark's efficiency. Rather than each user having their own onchain output, Ark consolidates multiple users' ownership claims into a single output called a Batch Output. This is achieved through Commitment Transactions.

Commitment Transactions

Commitment Transactions are the single onchain footprint that underpin the entire Ark protocol. An Ark Operator handles, or participates in, a Bitcoin transaction coordination protocol that creates a Commitment Transaction. A Bitcoin transaction is defined as an Ark Commitment Transaction if it contains two output types:

  • Batch Output:
    Encapsulates multiple users' ownership claims through a tree of presigned virtual transactions. Each user's claim is represented by a Virtual Transaction Output (VTXO), secured through a combination of multisig and presigned transactions.

  • Connector Output:
    Enables atomic batch swaps and UTXO exits by providing virtual anchor points for forfeit transactions. This output is controlled by the Ark Operator but provided to Batch Swaps users to facilitate seamless state transitions.

VTXO

A Virtual Transaction Output (VTXO) is a user's claim to a specific portion of value within a Batch Output. VTXOs mirror the semantics of Bitcoin's UTXOs, but exist offchain in Ark’s execution layer. They are created by Ark Transactions and remain enforceable through presigned exit paths anchored in Bitcoin.

Batch Outputs

As users register their requests to be included in a Batch, the Ark Operator proposes a Batch, that fulfills a set of requests. Every request consists of the user's signed inputs, their expected outputs, and the public keys used in the n-of-n scheme to enforce the transaction tree. Once the operator has confirmed that all request creators are available, a commitment transaction is constructed and a signing session for the Batch output is initiated.

tip

In the case of multi-party ownership of VTXOs, the request can provide multiple public keys to enforce the Batch output's transaction tree.

A batch output is locked to a Taproot address with an n-of-n Musig2 internal key, with all participants as cosigners, along with a taproot script spend leaf that allows the Ark Operator to unilaterally spend after the Batch Expiry.

Once all inputs and outputs of the commitment transaction have been provided (with only the signatures and witness data remaining, making the transaction hash final), a tree of virtual transactions that splits the Batch output into a set of VTXOs at its edges is created.

Each VTXO's virtual transaction parent is cosigned by each VTXO owner and the Ark Operator, while also having the same Batch expiry as a timelock.

Every cosigner then verifies the tree and signs their respective unroll path. As the Batch is finalized, witness data for the commitment transaction is signed and pushed, and the transaction is broadcast to the Bitcoin network.

tip

Each batch has a set expiry time, which is the time at which the Ark Operator can unilaterally spend the Batch output without collaboration from the Batch's cosigners. While users' using native ramps to fund their own initial onboarding batch, the Ark Operator bears a burden of provisioning additional liquidity as VTXOs commit into new batches to escape the original batch's funds being transferred to the Ark Operator at its expiry.

MuSig2 Implementation

Ark leverages MuSig2, an advanced schnorr multi-signature scheme, to enable efficient collaborative signing of transactions. This allows the sequential virtual transaction tree to require only one signature onchain, allowing a smaller footprint in the case of a unilateral exit.

Virtual Transactions

Any transaction that is created from the Batch Output is a virtual transaction. These transactions are fully valid Bitcoin transactions, ready to be broadcast to the Bitcoin network. In an optimistic scenario, these transactions will never be broadcast, as they are only used to provide unilateral exit. Every virtual transaction carries an additional anchor output, in the case of unrolling, to allow network fees to be paid out-of-band.

To secure the output from being spent maliciously, we use an n-of-n ownership model between all VTXO owners.

This structure enables any user to unilaterally exit by broadcasting their presigned path of virtual transactions.

Transaction Tree Structure

The Transaction Tree organizes virtual transactions in a hierarchical structure that enables individual users to exit without affecting other participants' VTXOs. When a user exits, they only need to broadcast the transactions along their specific path to their VTXO. This selective unrolling ensures other users' VTXOs remain in the batch, maintaining efficiency for the remaining participants.

The Transaction Tree balances transaction sizes with tree depth and signing interactivity. The key trade-offs include:

  • Larger trees: Require more interactive signing sessions during batch creation, as each branch of the tree needs to be signed by its participants.
  • Smaller trees: Reduce interactivity but could result in larger transactions or fewer independent paths.

Despite these trade-offs, the hierarchical nature of the Transaction Tree ensures independent exit paths for users—keeping the batch efficient and scalable without forcing others out.

Batch Expiry

Each Batch Output has an associated expiry time, after which the Ark Operator can unilaterally spend it to recover fronted liquidity. This is necessary because the Operator must provide the liquidity to fund new VTXOs in exchange for forfeited VTXOs.

The security model incorporates the Ark Operator as a cosigner on every virtual transaction, which serves two purposes:

  1. Prevents liquidity theft
  2. Ensures users cannot double-spend without operator collusion

To provide additional security, a time-delay is incorporated into the VTXO scripts:

This delay period allows both users and the Ark Operator to detect and mitigate attempts by previous owners to exit with spent claims.

Connector Outputs

The connector output is a complementary output to the Batch output, which is used to facilitate Batch Swaps atomically. It holds a similar tree structure to the Batch output, but is constructed and owned solely by the Ark Operator. For each Batch swap in a commitment transaction, the Ark Operator creates a virtual connector output, which is an Bitcoin output meant to spent in a forfeit transaction to ensure that a swap is conditional on the commitment transaction itself being confirmed.

tip

A connector output is not exclusively for the purpose of a Batch swap: it is also used to allow VTXOs to be swapped for an onchain UTXO exit.

Summary

Commitment transactions define the link between Ark's offchain execution layer and Bitcoin’s base layer. They commit:

  • Shared collateral as inputs funding Batch Outputs
  • Atomic links to VTXOs through Connector Outputs in Forfeit Transactions
  • Isolated user control via virtual transaction trees
  • Expiry logic for liquidity management