1. Home
  2. StarkNet
  3. Uncovering StarkNet: Grasping StarkEx

Uncovering StarkNet: Grasping StarkEx

Source: StarkWare

Tailored specifically for DApps that wish to leverage upon the scalability solutions on StarkNet and zk-STARKs (Zero-Knowledge Succinct Transparent Argument of Knowledge), StarkEx is an application-specific scalability engine built on the Ethereum blockchain. 

With the use of zk-STARKs, StarkEx is able to execute off-chain computation without sacrificing the security and trustlessness of the Ethereum blockchain. 

While StarkNet mostly focuses on building and deploying decentralized applications and smart contracts on the Ethereum network, StarkEx is a trading engine for decentralized exchanges that enables fast and cheap trading across multiple DEXs. It is designed to provide a high-performance trading experience by aggregating liquidity from different DEXs and performing trades off-chain. Analogically, you may think of the two as sisters that share similar traits, but possess different fundamental objectives.
Currently, StarkEx supports ETH, synthetic assets, and ERC-20, ERC-721, and ERC-1155 tokens. 

According to a Tweet by StarkWare dated 20 February 2023, transactions on StarkEx are supposedly 1000x cheaper than on Ethereum: 

Source: Twitter
Customisation and Flexibility 

Unlike the permissionless nature of StarkNet, StarkEx is permissioned as it is meant to cater to the specific needs of DApps. It supports both orderbook and Automated Market Maker (AMM) trading models and can handle a wide range of assets, including ERC-20 tokens, non-fungible tokens (NFTs), and even Bitcoin and other cryptocurrencies through the use of cross-chain bridges.

This means that while it is meant to be used by different protocols, it is generally expected to be utilised via three data availability modes: ZK-Rollup mode; processing data off-chain (also known as Validium); or a combination of the two modes known as Volition. Projects may opt to leverage upon any of these three modes depending on their specific requirements. For instance, as a decentralized exchange (DEX) platform, dYdX utilizes the ZK-rollup mode of StarkEx to ensure that transaction fees are kept low for its users. Comparatively, DeversiFi and Sorare utilize the Validium mode to cater to their own unique data management needs. 

A list of platforms that utilize different iterations of StarkEx to suit their needs. Source: StarkWare

As evidenced by its successful deployment on the Ethereum Mainnet since June 2020, StarkEx is considered a fairly mature platform. Prior to this deployment, the platform underwent rigorous testing, with over 50 million transactions settled on both public and private Ethereum testnets. 

StarkEx leverages a hybrid architecture comprising of on-chain and off-chain components to achieve its objectives of high-speed and low-cost spot trading while enabling users to retain control of their assets. 

Off-Chain Component 

StarkEx’s off-chain component is responsible for holding the state of orders, executing transactions, and sending state updates to the on-chain component. By handling these tasks off-chain, StarkEx achieves high throughput and low latency, enabling users to trade rapidly and at low cost. The off-chain component is also responsible for ensuring the privacy of user data by keeping all sensitive information off-chain.

Features of Off-Chain Component
  • Holds the state of orders
  • Executes transactions in the system
  • Sends state updates to the on-chain component
On-Chain Component 

On the flip side, the on-chain component is responsible for enforcing the validity of state transitions, holding state commitments and system assets, and managing on-chain accounts. The on-chain component is critical to the security and integrity of the platform, as it ensures that only valid state transitions are processed and that system assets are not compromised. Additionally, on-chain accounts are useful in the context of Layer 1 (L1) dApp interoperability and DeFi pooling.

Features of On-Chain Component
  • Enforces the validity of state transition
  • Holds state commitments and system assets
  • Manages on-chain accounts, which are useful in the context of Layer 1 (L1) dApp interoperability and DeFi pooling.
How does StarkEx work? 

For developers to interact with the platform, a basic understanding of how transactions are executed and verified on StarkEx is necessary, which we will be going through briefly below: 

Step 1: Execute Transactions via the Application

All transactions in the system are executed by the application and sent to the StarkEx Service. This includes trades, cancellations, and other actions related to spot trading.

Step 2: Batch Transactions and Proof Generation 

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. This step ensures that only valid transactions are processed and that the system remains secure.

Step 3: Proof Verification 

SHARP sends the STARK proof to the on-chain STARK Verifier for verification. The verifier checks that the proof is valid and that the transactions in the batch are authorized.

Source: StarkWare
Step 4: Update the State

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. This step updates the state of the system and records the transactions that have been processed.

Step 5: Interact with the System

You can interact with the system by sending on-chain transactions to the StarkEx Contract, and off-chain transactions to the application. On-chain transactions include actions such as depositing and withdrawing funds, while off-chain transactions are related to spot trading.

Closing Words 

As a relatively mature platform used by various different DApps and projects, StarkEx promises a flexible portfolio of features and services that buidlers can utilize, depending on the niche needs and requirements of their specific projects. 

For buidlers interested in bringing their projects onboard to the StarkEx ecosystem but are yet unsure of StarkEx’s capabilities, they may opt to engage in the StarkEx Playground, which offers a simulated environment on the Goerli testnet that provides developers with practical experience of StarkEx’s scalability solution. 

Currently, the StarkEx Playground offers simulated environments for Spot Trading and Perpetual Trading. Try your hands on StarkEx today! 

Related Articles

Leave a Reply

Your email address will not be published.