Risk Warning: Beware of illegal fundraising in the name of 'virtual currency' and 'blockchain'. — Five departments including the Banking and Insurance Regulatory Commission
Information
Discover
Search
Login
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt
BTC
ETH
HTX
SOL
BNB
View Market
Understand StarkWare: the Layer 2 solution provider behind dYdX and iMMUTABLE
Foresight
特邀专栏作者
2021-11-02 03:52
This article is about 10818 words, reading the full article takes about 16 minutes
StarkWare has supported the huge transaction volume of Layer 2 applications through cutting-edge technology and complete technical services. In the future, StarkWare will also embrace open source, achieve more decentralization, and help the construction

Written by: msfew@Foresight Ventures

Introduction to StarkWare

StarkWare mainly solves the scalability and privacy of the blockchain. StarkWare has developed a complete solution, using STARK technology, to generate and verify the proof of computational integrity through zk-Rollups and Validium mode to form Volition. StarkWare's cryptographic proof It can achieve zero-knowledge, simplicity, transparency and post-quantum security. The products developed by StarkWare mainly include: StarkNet, StarkEx, Cairo.

Scalability

  • Scalability

    Privacy

  • Privacy

    user experience

  • user experience

    Through the examples of iMMUTABLE and dYdX, we can experience the strong expansion capabilities of the solutions provided by StarkWare. The payment TPS of DiversiFi can reach 18k, the NFT casting fee of iMMUTABLE is only 0.2 cents, and the transaction fee of dYdX is reduced to 1/50 . Second confirmation, the fee rate is almost 0, bringing an excellent user experience.

milestone

2018: STARK white paper released, Ethereum Foundation Grant

2019: The first Demo is released (expanding the efficiency of Ethereum by 200 times), StarkEx Alpha releases the test network, and the second Demo is released (expanding the efficiency of Ethereum by 700 times)

2020: DeversiFi (StarkEx 1.0) releases the main network, VeeDo (Stark-based VDF) releases the main network, StarkEx Rollup releases the main network, ethSTARK releases, Cairo (Turing complete language for STARK) and its PlayGround release, Ziggy STARK (later Quantum Safe Security Signature) Released, StarkEx 2.0 Released Mainnet

2021: StarkNet announced, dYdX and Immutable X (both StarkWare customers) project launch mainnet

iMMUTABLE and StarkWare

iMMUTABLE is the first Layer 2 NFT trading platform. Tik Tok cooperated with iMMUTABLE in September and released a series of NFT.

Since the local throughput of Ethereum is capped at 4 transactions/second, any DApp that wishes to scale is limited. For NFT, the throughput bottleneck is even greater than that of ordinary Token: with NFT, a thousand Token actually consumes the blockchain The resource is thousands of times that of a single Token. iMMUTABLE hopes to use the native solution of Ethereum to enjoy the security, development tools and network effects of Ethereum, so it adopts the solution provided by StarkWare.

One of the unique features of the solution offered by StarkWare is its ability to be deployed in several data availability modes: zk-Rollups or Validium. Both are based on proof of validity, but in zk-Rollups all data is on-chain However, in Validium, the data is kept off-chain, and only the latest state is submitted, as well as the on-chain submission of the validity proof of the state. iMMUTABLE starts with Validium mode, providing lower gas fee. Due to policies and regulations Regulations, the Data Availability Committee (DAC) ensures that users always have access to their data. So iMMUTABLE switched to Volition’s new data availability model, which will allow users to choose where their data is stored—on-chain (zk-Rollups ) or off-chain (Validium). At the same time, this approach also maximizes performance expansion.

In the blog post on the cooperation between Tik Tok and iMMUTABLE, Tik Tok specifically mentioned that StarkWare is the first carbon-neutral L2 expansion solution. From the perspective of traditional Internet companies, environmental protection is very important. Therefore, L2's high performance and resource-saving features can also attract the attention of traditional Internet companies, paving the way for them to enter the cryptocurrency field openly.

The solution provided by StarkWare to iMMUTABLE finally allowed Tik Tok, the most popular company at present, to find iMMUTABLE for cooperation. The two deployment modes provided by StarkWare give customers the flexibility of data storage methods, which not only comply with regulations, but also improve performance It can be expanded. More importantly, the expansion of performance has also solved the controversial energy consumption problem of Ethereum. This will be a victory for Layer 2 and StarkWare. In the future, we will definitely see more Traditional enterprises choose Ethereum and StarkWare to enter the blockchain field.

Why do StarkWare applications have such high performance?

StarkWare's Prover has various mathematical optimizations and some optimization algorithms first proposed by StarkWare, and the Cairo language used for development has special mathematics-related optimizations. In addition, before the interactive data is sent to Prover, the StarkEx engine will be used to coordinate the data to be proved and batch processing. The entire operation process has been optimized for full coverage. Details will be discussed in detail later.

How decentralized are StarkWare applications?

The consensus on StarkNet of StarkWare is zk-STARK. zk-Rollups are not necessarily decentralized and have no access restrictions. But the zk-STARK used by StarkWare has no access restrictions, just like public chains such as Ethereum. In the middle process of the application made by StarkWare, there will be some centralized servers to provide some services. But this is necessary and cannot be removed in the development of a complete application. Just like uniswap must have a centralized domain name and front-end Same. So dYdX, StarkNet etc. made by StarkWare are still decentralized.

zkSync vs StarkWare

At present, StarkWare is ahead of zkSync in terms of performance and current operating status. The biggest difference between zkSync and StarkWare is the operating concept. The projects of zkSync are all open source, and it doesn’t matter if the team says they are replaced, as long as they can Promote the development of the community and Ethereum. StarkWare is a toB centralized mode of operation. STARK prover can only be used by StarkWare at present, and Cairo is actually not so beneficial to the ecology of Ethereum (friendly to developers) The approach should be to be EVM compatible like zkSync or Optimistic).

zk-Rollups and STARK proofs

  • The technology used by StarkWare includes zk-Rollups and zk-STARK. These two are not the same thing. STARK is zk-STARK, which is a kind of zero-knowledge proof.

  • StarkWare tends to call its solution Validity Rollups, because zk-Rollups is not necessarily used in the solution. Validity Rollups includes Validium and zk-Rollups. The difference between the two is whether user data is on-chain.

    https://immutablex.medium.com/eli5-nft-scaling-solutions-b1de4ad82461

STARKs improve scalability by allowing developers to move computation and storage off-chain. Off-chain services will be able to generate STARK proofs attesting to the integrity of off-chain computations. These proofs are then put back on-chain for verification by any stakeholder Computation. Use STARK to move most of the computational work off-chain, allowing existing blockchain infrastructure to scale exponentially while maintaining computational integrity.

The general process of Ethereum data chaining: 1000 transactions are sent to each node of Ethereum → each node reads 1000 transactions → nodes update 1000 transactions

zk-STARK data on-chain process: 1000 transactions are sent to zk-STARK → zk-STARK acts as a prover, generates 1 certificate (* generation stage) → node reads the certificate as a verifier, updates

*Generation phase: Usually zk-STARK proofs require the following process to generate proofs. The proof process of the verifier is divided into two steps: the first step is to generate an algebraic intermediate code representation after calculating the integrity statement, and the second step is to pass the test Generate FRI (an optimization method for proofs in a paper written by StarkWare Co-Founder in 2017), and then output an expandable open and transparent knowledge argument (that is, STARK) after an encryption algorithm. In short, through a safe and trusted environment and optimized algorithms to generate a credible and high-performance proof.

zk-Rollups compared to other L2 schemes

  • Strictly speaking, the term zk-Rollups used in many StarkWare documents does not necessarily use zero-knowledge proofs, and the correct description is Validity Proofs (including zk-Rollups and Validium, because StarkWare provides two modes). To avoid terminology Changes affect the understanding, this article refers to the relevant expressions as zk-Rollups according to the StarkWare documents.

    https://twitter.com/EliBenSasson/status/1453260406357729288

  • Sidechain (Polygon or xDai)

    Pros: Even if users make a lot of transactions, only two things happen on the main chain, namely deposit and withdrawal. Since the transaction cost on the side chain is lower than Ethereum itself, scalability can be obtained.

    state channel

  • state channel

    Pros: An example of a state channel is the Lightning Network. State channels are useful when participants will be exchanging a large number of state updates over a long period of time. Strong privacy, as the state between them only happens within the channel. Instantaneous Finality, as soon as it ends, it ends immediately.

    Disadvantages: state channels are very dependent on validity, and are more suitable for applications with a certain set of participants.

  • Plasma

    Advantages: Plasma is very suitable for dealing with NFT, because each NFT has a unique ID. One of the problems with sidechains is that the consensus mechanism can stop block production or even lock user funds; Plasma users can call Block root, so if the consensus mechanism stops creating Block, users can still request funds from Ethereum.

    Cons: If many users exit their Plasma chains at the same time, they could overwhelm the root chain and congest the network. Things like fraudulent activity or cyberattacks could cause such a large-scale exodus. Another drawback is the lack of complexity, Users cannot perform the same types of complex operations as they can on sidechains, simulating the full Ethereum environment.

  • zk-Rollups

    Pros: Low cost per transfer. Faster than Plasma and Optimistic Rollups. Less data leads to higher throughput and scalability. Cons: Initial setup is not decentralized (no initial setup in STARK), Quantum Computing Could Poses Future Hacking Threat (STARK Can Resist Quantum Computers)

After comparing various L2 solutions, we can find that zk-Rollups may be the perfect solution closest to blockchain upgrade and expansion. At the same time, the few shortcomings of zk-Rollup will be found in zk-STARK adopted by StarkWare fix.

Performance comparison between STARK and other ZKs

There are mainly three types of ZK proofs: SNARK, STARK, and Bulletproof. Bulletproofs and STARK do not require trusted settings, and STARK uses publicly verifiable randomness to create an untrusted and verifiable computing system. Compared with the other two, STARK The proof size is very large, but it has great advantages in calculation size and proof speed. At the same time, STARK has higher security and can resist quantum attacks.

first level title

StarkNet

  • StarkNet Alpha will launch on the Ethereum mainnet in November.

Introductionhttps://voyager.online

Introduction

StarkNet is a decentralized, permissionless and censorship-resistant L2 zk-Rollups that supports general-purpose computing on Ethereum. It is based on the Turing-complete Cairo language. Developers can build applications to implement App business logic and Deployed on StarkNet; users can send transactions to StarkNet for execution in the same way as normal Ethereum transactions. StarkNet nodes and participants will be economically incentivized to ensure that the network operates efficiently and fairly.

All StarkNet transactions will be batched regularly, and the transactions will be proven in STARK proofs, and finally verified on Ethereum. Since the computational effort required to verify STARK proofs is exponentially smaller than that of Ethereum proofs, Therefore, StarkNet can expand Ethereum by several orders of magnitude. Since all StarkNet state transitions will be verified by STARK, Ethereum only accepts the final valid state transition.

Main features: performance scalability, development convenience, and composability for the Ethereum ecosystem.

Network ecology

  • Programming language Cairo: Cairo is a Turing-complete high-level programming language and framework that can be used to generate STARK proofs. Developers can use Cairo to define any business logic, send transactions to Shared Prover Service to verify the logic off-chain and Validation on the chain. Cairo is ready for formal project development on the mainnet and available for developers.

  • Off-chain verification service Shared Prover Service: Before the transaction is uploaded to the chain, the transaction will be sent to Sharp for verification, to judge the integrity of the application program execution, and to calculate the gas fee for sharing proof verification.

  • Open source prover ethSTARK: ethSTARK provides zero-knowledge and post-quantum security signatures. ethSTARK processed 300,000 transactions in a proof on the main network, and the TPS reached 3,000. The Rollup gas efficiency also broke the world record and reached 315 gas/tx, which is higher than Ethereum Transactions on L1 are orders of magnitude cheaper. This technology is the cornerstone of StarkNet's decentralized proof-of-concept layer.

  • Use Cases

Use Cases

  • DeversiFi: Transaction TPS 9k, payment TPS 18k.

  • iMMUTABLE: NFT minting gas 0.2 cents, daily L2 transaction > weekly L1 transaction.

  • Introduction

StarkEx

Introduction

  • StarkEx is like a low-level engine that composes components to support applications using STARK.

StarkEx is a production-ready L2 scalability engine, deployed on the Ethereum mainnet since June 2020. StarkEx utilizes STARK technology to provide scalable self-hosted transactions for applications such as DeFi and gaming. StarkEx supports a wide range of use cases: Spot trading, perpetual trading, and NFT minting and trading. Over 50 million StarkEx transactions were settled on public and private Ethereum testnets prior to mainnet deployment.

features

features

  • Scalability and Computational Integrity Applications can rely on StarkEx and the underlying STARK infrastructure to scale, while StarkEx ensures computational integrity. Through SHARP (Shared Prover) technology, gas costs are amortized across all StarkEx-based applications.

  • Diverse deployment modes StarkEx can deploy zk-Rollups mode (publishing data on the chain) or Validium mode (verifying data availability through side chains). There is also an upcoming mode: Volition, which allows users to choose the data availability mode for themselves.

  • Wallet Integration StarkWare offers native support via Ledger, Authereum, and WalletConnect. StarkWare also offers MetaMask integration via Web3-compatible key generation (works with many other existing wallets).

Architecture and Business Logic

The above picture is a typical application architecture diagram using StarkNet and StarkEx. Suppose this application is a DEX called Starkswap.

  • The application in the yellow box on the far left - operate the entire application

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

    This component is the centralized front end of the application, usually web or client.

  • StarkEx Services in Light Blue Box - Batch and Coordination

    An off-chain component that is responsible for batching a set of operations and updating the system state based on the operations. For each batch, it will convert the batch of operations (executed by Cairo language, first convert the bytecode of Solidity into the smart contract of Cairo language , running in the Cairo locale) is sent to SHARP to prove its validity. Once the proof is verified, it publishes a new state on-chain. The state is represented by a Merkle tree. The structure and content of each vault is based on Varies depending on the specific business logic implemented. The Merkle root represents the state to be committed to the chain.

  • SHARP - Shared Authenticator (customized by StarkWare for applications)

    SHARP is a shared proof service for the Cairo language. It receives proof requests from different applications and outputs proofs to prove the validity of Cairo code execution. The output proofs can be shared among multiple proof requests.

    The previous name of this component was Generic Prover Service. So the component is essentially a backend server, which contains some specific services. It is speculated that it is deployed on StarkWare's centralized server.

  • StarkEx Contract (Verifier Contract) - Status Updates, Deposits and Withdrawals

    The contract has two main functions. The first function is to update the state of the system after verifying that the validity conditions are met, and the second function is to manage deposits and withdrawals in and out of StarkEx in a non-custodial manner (in any case, users can withdraw their funds).

    This component is a smart contract on Ethereum.

The business logic of Starkswap is as follows:

  • Processing Requests The StarkWare application in the light blue box processes customer requests, converts these transactions into provable statements, and sends these to SHARP in the dark blue box. All requests are sent and processed through the first The API of the first step and the batch statement in the second step are sent (one batch can compile multiple requests).

  • SHARP Proof SHARP construction proof in dark blue.

  • Proof of Enrollment SHARP transfers the proof to the on-chain validator smart contract in Step 3 in the pink box.

  • In the fourth step of registration state transition, the StarkWare application performs application state transition on the Starkswap smart contract. In the fifth step, to ensure the validity of the transition (SHARP verification), the Starkswap smart contract confirms that the transition statement has been registered in the Verifier smart contract Register in.

Function and Encryption Algorithm

https://docs.starkware.co/starkex-v3/crypto/stark-curve

Function details:

  • Off-chain status:

    Balance tree and sequence tree. Through the Merkle tree, the security and credibility of the fund state are guaranteed, and the double-spending problem is avoided.

  • Flow Description:

  • On-chain accounts (The balance of the account is stored and managed off-chain, unless the funds are moved into/out of the on-chain account. From the perspective of L1, the funds of these accounts are stored under the StarkEx smart contract.)

  • owner"owner"Therefore, L1 users and applications can trade through StarkEx and match any pending orders. The on-chain trading model enables interoperability between StarkEx applications and L1 applications, which can be used for DeFi Pooling or used by liquidity aggregators ).

  • StarkEx specific concepts:

    There are many concepts in StarkEx that are different from Ethereum, so development requires additional learning.

    https://docs.starkware.co/starkex-v3/starkex-deep-dive/starkex-specific-concepts

  • In addition, StarkEx also has specific operations such as information encryption, batch flash loans, and DeFi pooling.

Encryption Algorithm:

STARK Elliptic Curve, Pedersen Hash Function,KDF. By using the above encryption algorithm and referencehttps://github.com/authereum/starkware-monorepo/tree/starkex-3.0/packages/starkware-provider#walletconnectIntroduction

Cairo

Introduction

Cairo is the first production-grade platform to generate STARK proofs. It is Turing complete and very efficient. To deploy high-performance and low-gas Layer 2 application components on StarkNet, you need to use Cairo to write applications. Cairo The language is not a special contract language, but it can and is mainly used to write contract-like content.

features

features

  • computational integrity

    Computational integrity represents the fairness of computing without supervision. There are five ways to ensure Computational Integrity: bank entrusted accountability (based on reputation, auditing, etc.), computing replayability (such as bit coins and other L1 public transactions), trusted execution environments (such as Intel's SGX), fraud proofs (Optimistic rollups, between delegated accountability and computational replayability), cryptographic proofs (zk-STARK). The Cairo language has been verified by many papers and mathematical proofs, and can safely and credibly generate zk-STARK proofs to ensure computational integrity.

  • AIR (Algebraic Intermediate Code Representation)

    language design

  • language design

    The design of the Cario language follows the principle of Minimal Variable Language, and it is just right. At the same time, it achieves the expressiveness of the language (easy to read for developers) and the generation efficiency of STARK proofs. The design of the Cario language is not too complicated. There are only three registers (PC, allocation pointer, frame pointer), and a concise instruction set. The Cario language also supports some necessary functions, including functions, recursion, branching, judgment, etc. The Cario language design feels more in line with the logic of mathematical proofs and is more neat.

  • tool chain

    translater (https://github.com/NethermindEth/warp) ,Virtual machine, code editing environment plug-in (code prompt plug-in on VSCodehttps://github.com/ericglau/cairo-ls),Tracker, code example (https://github.com/starkware-libs/cairo-examples).

language ecology

At present, the ecology of the Cairo language can be said to be very comprehensive but young. It has all kinds of tool chains. According to the GitHub stars of these tools, it can be judged that it has not received much attention, but the developers of the warehouse are constantly updating, basically in one There are new submissions within two weeks. In the future, the Cairo language will be more open. After training more developers, the work of writing Cairo code on the StarkEx engine is likely to be handed over from StarkWare to open source developers. Decentralization would make a lot of sense.

More importantly, OpenZeppelin is implementing basic templates such as ERC-20 and ERC-721 in the Cairo language (https://github.com/OpenZeppelin/cairo-contractsSummarize

Summarize

As a Layer 2 solution provider, StarkWare has produced explosive products such as dYdX and iMMUTABLE. Among various solutions, StarkWare's zk-STARK technology supports the largest number of transactions on Layer 2. Mathematical optimization from Prover , the mathematical optimization of the Cairo language, and the proof coordination of the StarkEx engine, StarkNet, as a decentralized zk-STARK network, provides extremely high performance and fully optimizes the operation process. StarkWare uses cutting-edge technology and complete technical services , supports the huge transaction volume of Layer 2 applications, and will embrace open source in the future to achieve more decentralization and help the construction of Ethereum 2.0.

Related Links:

iMMUTABLE: https://www.immutable.com/blog/design-architecture, https://medium.com/starkware/starkex-now-for-nfts-bfdc9f4655a2

Layer 2: https://academy.moralis.io/blog/comparing-layer-2-ethereum-scaling-solutions, https://www.bcskill.com/index.php/archives/965.html, https://l2beat.com/faq/

ZK: https://ethereum.stackexchange.com/questions/59145/zk-snarks-vs-zk-starks-vs-bulletproofs-updated/63778, https://consensys.net/blog/blockchain-explained/zero-knowledge-proofs-starks-vs-snarks/, https://medium.com/unitychain/reveal-mysterious-zk-starks-42d00679c05b

StarkNet: https://medium.com/starkware/on-the-road-to-starknet-a-permissionless-stark-powered-l2-zk-rollup-83be53640880, https://starkware.co/product/starknet/, https://medium.com/starkware/starknet-alpha-is-coming-to-mainnet-b825829eaf32

StarkEx: https://docs.starkware.co/starkex-v3/architecture/solution-architecture

Cairo: https://medium.com/starkware/hello-cairo-3cb43b13b209, https://www.youtube.com/watch?v=QPNp8w9rx7o, https://arxiv.org/abs/2109.14534

zkSync: https://www.reddit.com/r/ethereum/comments/q8q822/ama_were_matter_labs_the_team_behind_zksync_the/, https://members.delphidigital.io/reports/ethereum-layer-2-rollup-debate-optimism-starkware-arbitrum-and-zksync/, https://twitter.com/KyberNetwork/status/1372593913786109953, https://blog.kyber.network/research-trade-offs-in-rollup-solutions-a1084d2b444

General: https://academy.moralis.io/blog/what-is-starkware-and-starks

dYdX
Layer 2
Welcome to Join Odaily Official Community