Dwarves
Memo
Type ESC to close search bar

StarkNet architecture

StarkNet layer 2 solution

StarkNet is a layer 2 blockchain solution using ZK rollup, it provides StarkDex technology for well-known applications such as dYdX, ImmutableX, Sorare. It allows decentralized exchanges to process transactions with fast speed and low costs. Its essence is to reduce computations, store on-chain, replace with off-chain computations and store off-chain, Store balance using merkle tree with root merkle tree stored on-chain

StarkNet architecture overview

The system consists of 6 main components:

How does it work

The process consists of four steps:

  1. Batching is Sequencer, groups together multiple transactions into a batch for processing. The entired batch is submit on-chain as a single compressed state update with a proof.
  2. Validating & Updating The update is then compressed in the form of a hash on the entire state of the system : ℎ(ℎ(ℎ(class_hash,storage_root),0),0) Where:
  1. Generating a Proof Once the batch transaction is processed, StarkEx generates a STARK proof to confirm the correctness of the transactions.
  2. On-chain Verification Once the proof is verified, the state update is committed and settled on layer 1 Ethereum

Messaging Mechanism

Contracts on L2 can interact asynchronously with contracts on L1 via the L2→L1 messaging protocol.

Contracts on L1 can interact asynchronously with contracts on L2 via the L1→L2 messaging protocol. The protocol consists of the following stages:

StarkNet transaction lifecycle

When the transaction is submitted to the StarkNet, it is sent to the Sequence node. Sequencer takes a batch of transactions and generates:

Node clients

StarkNet nodes use the Pathfinder or the Juno client and they are similar to the nodes running Go Ethereum

Reference

Smart contract