Data Availability Modes
Your users need to know that they have control over their funds, and that they can retrieve their funds at any time, in case your application is not functioning correctly.
To facilitate this self-custody, StarkEx-powered applications must make their users' data always available.
Data availability means that the full state tree is always available, which provides users with the security of knowing that if StarkEx ever stops functioning, they can prove custody of their funds.

StarkEx supports Volition to make data available. Volition enables two sets of vaults to provide data availability as follows:
• ZK-Rollup: Vault balances are published on-chain as calldata. The ZK-Rollup provides built-in trustlessness. Vault range:
$2^{63}, 2^{63}+2^{31}$
• Validium: Data is available off-chain. The Data Availability Committee (DAC) stores Validium vaults' balances, providing a trusted solution to make your users’ data available. Vault range:
$0, 2^{31}$
One application can support both ZK-Rollup and Validium vaults. Assets can be transferred between the different vault ranges.
The vault size results in the following:
• Each signature has 64 bits allocated for vaults.
• When depositing to a ZK-Rollup vault, the 63rd bit of vaultId must be on. The roots of both vault trees are updated when UpdateState is called. The updated balances of rollup vaults are also emitted on-chain as calldata.
An escape hatch is checked against the tree in which the escaped vault is located.

StarkEx supports ZK-Rollup to make data available. Vault balances are published on-chain as calldata. The ZK-Rollup provides built-in trustlessness. The vault range is:
$2^{63}, 2^{63}+2^{31}$

# ZK-Rollup

When using ZK-Rollup, the Cairo program ensures that all the required data to recover the L2 balances Merkle Tree is published on-chain as calldata. The output of a Cairo program when using ZK-Rollup includes the following:
• The proven new state
• The complete list of differences of the users' balances compared with the previous state
In order to reduce calldata usage, and thus, gas, StarkEX does not publish all on-chain transactions, just balance changes. For example, if Alice sends 500 USDC to Bob, and then receives 200 USDC from Charlie, StarkEx only publishes Alice's new vault, which is now 300 USDC less than the previous state. This optimization is very efficient for real-life scenarios when heavy market makers comprise a large portion of the transactions, using only several vaults.
Advantage: ZK-Rollup is trustless. All the data needed to reclaim user's funds on an escape event is present and visible on the blockchain.
Disadvantage: Each vault that has changed in the batch incurs a gas cost. So for batches in which many vaults' states change, the cost of a state update event applies mostly to the data availability, rather than the verification of the proof.

# Validium (StarkEx for Spot Trading)

When using Validium vaults, users' balances are not published on-chain. Rather, they are sent to several well known and trusted parties who are members of the Data Availability Committee (DAC). A state update is valid and accepted on-chain only if at least a quorum of the committee members sign a state update. Specifically, they sign that they know all the new vault balances such that they determine to the new state, as enforced by the availability verifiers.