What is a VTXO?
A Virtual Transaction Output (VTXO) represents your ownership of funds within the Ark. Unlike a regular Bitcoin UTXO that exists directly on-chain, a VTXO is an off-chain construct backed by a chain of pre-signed transactions that can be broadcast to claim your funds.Think of a VTXO as a “promise” of on-chain Bitcoin that you can either spend off-chain (cooperatively) or claim on-chain (unilaterally) at any time.
VTXO Structure
TheVtxo struct is defined in lib/src/vtxo/mod.rs:
Key Components
VTXO ID- 36-byte identifier:
[txid: 32 bytes][vout: 4 bytes] - Uniquely identifies each VTXO
- Encoded as
VtxoIdtype
- Denominated in satoshis
- Subject to dust limits (currently 330 sats for P2TR)
- May have maximum limits set by server (
max_vtxo_amount)
- Reference to the on-chain UTXO that anchors this VTXO
- Must be confirmed for the VTXO to be valid
- Can be a round transaction output or board transaction output
- Number of transactions required for unilateral exit
- Calculated as:
genesis.len() - Typical depths: 1 (board), 3 (round), 3+ (arkoor with history)
VTXO Policies
VTXOs can have different spending policies based on their purpose:Policy Types
1. Pubkey (Standard VTXO)- Standard user-owned VTXO
- Can be spent cooperatively with server
- Can be exited unilaterally after
exit_delta
- Used when sending Lightning payments
- Locked until payment preimage revealed
- Automatically exits if near expiry without settlement
- Used when receiving Lightning payments
- User can claim with preimage
- Falls back to exit if preimage not revealed in time
Server-Only Policies
These policies are used internally by the server:- Checkpoint: Intermediate outputs in arkoor transaction chains
- Expiry: VTXOs that have expired and can be reclaimed by server
- HarkLeaf: Hash-locked arkoor leaf outputs for atomic swaps
VTXO Lifecycle
1. Creation
VTXOs are created during:- Boarding: Converting on-chain funds to Ark
- Rounds: Refreshing existing VTXOs or receiving payments
- Arkoor transfers: Receiving off-chain payments
- Lightning receives: Settling incoming Lightning payments
2. Active Use
While active, VTXOs can be:- Spent in arkoor transfers
- Combined with other VTXOs for payments
- Used to pay Lightning invoices
- Offboarded cooperatively
- Refreshed to extend lifetime
3. Expiry
All VTXOs have anexpiry_height:
Typical expiry timeline:
4. Exit
VTXOs can be exited:- Cooperatively: Via offboard in a round (preferred)
- Unilaterally: By broadcasting exit transactions (emergency)
Genesis Items and Exit Transactions
Each VTXO contains agenesis vector of GenesisItem structures that encode the exit transaction chain:
Exit Transaction Chain
When you exit a VTXO unilaterally, you must broadcast a chain of transactions:- First transaction: Spends the chain anchor (on-chain UTXO)
- Intermediate transactions: Navigate down the tree structure
- Final output: Your VTXO output with your pubkey
Genesis Transitions
Three types of transitions connect exit transactions: 1. Cosigned- Used for round VTXOs and board VTXOs
- Requires MuSig2 aggregated signature
- Most common transition type
- Used for arkoor transfer outputs
- Includes past cosigners for audit trail
- Enables multi-hop arkoor chains
- Used for hArk (hash-locked arkoor) leaf outputs
- Enables atomic swaps
- Preimage revealed to complete payment
VTXO Validation
Before accepting a VTXO, clients validate:- Chain anchor exists on-chain and has required confirmations
- All signatures are valid in the exit transaction chain
- All outputs are standard for relay purposes
- Fee anchors are present to enable CPFP fee-bumping
- Expiry height is reasonable and not already passed
- Amount calculations are correct throughout the chain
VTXO validation is critical for security. Never accept VTXOs without validating them against the confirmed chain anchor transaction.
Transaction Weight and Fees
Each exit transaction in the chain has a fixed weight:- Each transaction includes a fee anchor output
- Users can CPFP (Child-Pays-For-Parent) to bump fees
- Total cost =
exit_depth × EXIT_TX_WEIGHT × fee_rate
VTXO Encoding
VTXOs are encoded usingProtocolEncoding for efficient serialization:
- Version: 2 (current), with backward compatibility for version 1
- Size: Variable, typically 500-2000 bytes depending on depth
- Format: Binary encoding optimized for network transmission
Working with VTXOs
Iterating Exit Transactions
Checking Expiry
Calculating Exit Depth
Best Practices
DO:
- Monitor VTXO expiry heights
- Validate all received VTXOs
- Refresh VTXOs well before expiry
- Keep exit transactions ready for emergencies
- Understand the exit depth for fee planning
- Accept VTXOs without validation
- Let VTXOs expire unrefreshed
- Assume the server will always cooperate
- Ignore exit transaction fee requirements
- Create VTXOs below the dust limit
Further Reading
Rounds
How VTXOs are created and refreshed
Exits
Claiming VTXOs on-chain