High-level overview
StarkEx is an Ethereum Layer 2 (L2) scalability solution that is based on validity proofs.
Every application built on top of StarkEx defines its own business logic and runs on the StarkEx Service.
Offchain and onchain components
The StarkEx system has an offchain component and an onchain component.
- The offchain component
-
-
Holds the state of orders
-
Executes transactions in the system
-
Sends state updates to the onchain component
-
- The onchain component
-
-
Enforces the validity of state transition
-
Holds state commitments and system assets
-
(StarkEx Spot Trading) Manages onchain 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.
-
More about Validium on StarkWare’s site.
The StarkEx flow
-
All transactions in the system are executed by the application and sent to the StarkEx Service.
-
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.
-
SHARP sends the STARK proof to the onchain STARK Verifier for verification.
-
The StarkEx Service then sends an onchain 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 onchain transactions to the StarkEx Contract, and offchain transactions to the application.
Your user’s interactions
-
Your user deposits their funds to the StarkEx Contract.
-
After the application accepts the deposit, your user can access their funds offchain.
Types of user interactions
Your user submits transfers or limit orders, signed by their private Stark key, 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 offchain withdrawal request to the application. This request is sent to the StarkEx Service, and the user can access their funds onchain 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.
-
StarkEx Spot Trading:
-
Trade for information about Limit orders
-
StarkEx Perpetual Trading:
System components
The StarkEx system consists of the following components:
Application |
The end-user software that interfaces with StarkEx. This offchain component receives user transactions and defines the business logic and order of execution. It passes transactions to the StarkEx service. |
Operator |
The entity that owns and is reponsible for the application. |
StarkEx service |
Batching and coordination. An offchain 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 onchain. 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. For more information, see Offchain state (StarkEx Perpetual Trading) or Offchain state (StarkEx Spot Trading). The Merkle tree root represents the state commitment to be submitted onchain. |
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 onchain component that receives and verifies a state-update validity proof. |
StarkEx Contract |
State updates, deposits, and withdrawals. This contract has two main functions:
|