Data Availability Modes
StarkEx supports two data availability modes: ZK-Rollup and Validium. Each application can choose the mode it prefers. Below, we describe the two modes, and discuss the advantages and disadvantages of each.


In the ZK-Rollup mode, all the relevant data that is used to recover the L2 balances Merkle Tree is published on-chain as calldata. This is enforced by the Cairo program; the output of a Cairo program in ZK-Rollup mode includes, in addition to the proven new state, the complete list of differences of the users' balances from the previous state.
In order to reduce calldata usage (and thus, gas), StarkEX does not publish all the on-chain transactions made, but rather just the balance changes. For example, if Alice transferred Bob 500 USDC, and then got from Charlie 200 USDC, we will only publish Alice's new vault, with a minus of 300USDC, compared to the previous state. This optimization is very efficient for real-life scenarios when heavy market makers make a large portion of the transactions, using only several vaults.
The advantage of the ZK-Rollup mode is that it is trustless. All the data needed to reclaim user's funds on an escape event is right there on the blockchain - there are no additional trust assumptions.
Note: There is an additional cost for trustlessness: in ZK-Rollup, there is a cost per vault that has changed in the batch (gas cost of calldata). In practice this means, that for batches that changed a few thousand vaults or more, the majority of the gas spent in a state update event will be spent on the ZK-Rollup data availability solution, and not on the verification of the proof itself.


In Validium mode - the balances of the users are not published on-chain, but rather sent to several well known and trusted parties, also known as committee members. 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.
One advantage of Validium is its cost: the payment for on-chain data is not required with this mode. State update costs only the gas for verifying the proof.
Another advantage is privacy: users' balance information is stored privately with a committee of trusted parties and not publicly on the blockchain.
Copy link