High-level overview

StarkEx is an Ethereum Layer 2 (L2) scalability solution that is based on validity proofs. It can make data available using either ZK-Rollup or Validium.

Every application built on top of StarkEx defines its own business logic and runs on the StarkEx Service.

The StarkEx system has an off-chain component and an on-chain component.

The off-chain component:

  • Holds the state of orders

  • Executes transactions in the system

  • Sends state updates to the on-chain component

The on-chain component:

  • Enforces the validity of state transition

  • Holds state commitments and system assets

  • (StarkEx for spot trading) Manages on-chain accounts, which are useful in the context of Layer 1 (L1) dApp interoperability and DeFi pooling.

StarkEx makes your user’s data available using the following data availability modes:

  • ZK-Rollup mode.

  • Validium mode.

  • Volition mode, which enables your user to choose between ZK-Rollup or Validium mode for each transaction.

StarkEx flow

The StarkEx flow

  1. All transactions in the system are executed by the application and sent to the StarkEx Service.

  2. The StarkEx Service batches transactions and sends the batch to SHARP, a shared proving service, to generate a proof attesting to the validity of the batch.

  3. SHARP sends the STARK proof to the on-chain STARK Verifier for verification.

  4. The StarkEx Service then sends an on-chain state update transaction to the StarkEx Contract, which will be accepted only if the verifier finds the proof valid.

You interact with the system by sending on-chain transactions to the StarkEx Contract, and off-chain transactions to the application.

Your user’s interactions

  1. Your user deposits their funds to the StarkEx Contract.

  2. After the application accepts the deposit, your user can access their funds off-chain.

Types of user interactions

Your user submits transfers or limit orders, signed by their starkKey, directly to the application. Limit orders are matched together and sent as a settlement to the StarkEx Service. Transfers are sent as-is. Additional logic can be enforced on different types of transfers.

To withdraw their funds, your user submits an off-chain withdrawal request to the application. This request is sent to the StarkEx Service, and the user can access their funds on-chain once the state update containing the withdrawal is accepted.

To prevent censorship, if the user’s withdrawal requests are not fulfilled, they can force the execution with forced transactions.

System components

The StarkEx system consists of the following components:

Operator, also referred to as system operator

Your application.

This off-chain component receives user transactions and defines the business logic and order of execution. It passes transactions to the StarkEx Service.

StarkEx service

Batching and coordination.

An off-chain component responsible for batching a set of operations and updating the state of the system as a result of these operations. For each batch, the StarkEx service sends the batch of operations, as a Cairo execution trace, to the shared prover, SHARP, in order to prove its validity. Once the proof is verified, the service publishes the new state on-chain.

The state is represented by a Merkle tree in which leaves are vaults. The structure and content of each vault vary according to the specific business logic implemented. See here for more details. The Merkle tree root represents the state commitment to be submitted on-chain.

SHARP

Proving.

A shared proving service for Cairo programs. It receives proof requests from different applications and outputs proofs to attest to the validity of Cairo executions. The output proof can be shared among multiple proof requests.

STARK Verifier

Verification.

An on-chain component that receives and verifies a state-update validity proof.

StarkEx Contract

State updates, deposits, and withdrawals.

This contract has two main functions:

  • Update the state of the system after verifying that the validity conditions are met.

  • Manage deposits and withdrawals to and from StarkEx in a non-custodial manner, so that in any scenario, your user can withdraw their funds.