Vessel
  • ⚓Introducing Vessel
    • Why Vessel Is The Exchange Crypto Needs?
    • Vessel's Roadmap for the Future of DeFi
  • ⚙️Technical Deep Dive
    • Sequencer
    • Prover
    • Contract
    • Data Availability
  • 💰VAELOB
    • Terminology
    • Order Book and AMM: Can We Have the Best of Both?
    • A Typical Trade in Vessel
    • Liquidity Pool Math
    • Concentrated Liquidity
    • Fee Calculation
    • Multi-Pool with Different Tick Spacing
  • 🎁Vessel Voyage
    • Vessel Mileage for Liquidity Providing
    • Vessel Coins for Referral
  • 🛳️Mainnet User Guide
    • Set up a Wallet
    • Deposit
    • Provide Liquidity to Vessel’s VAELOB
      • Access the Liquidity Pools
      • Add Liquidity
      • View Positions
      • Manage Positions
    • Trade
      • Order Types
      • Place Order
      • Cancel Order
      • Modify Order
      • Trading History
    • Internal Transfer - Send to Vessel's User
    • Withdraw Your Assets
    • Fees
      • Trading Fee
      • Gas Fee
      • AMM Fee
    • Trading Settings
  • 🛥️Testnet User Guide
    • Log in with Invitation Code
    • Setting up a Wallet
    • Switching Network
    • Funding Your Wallet
    • How to Deposit
    • How to Trade
    • How to Withdraw
    • Community Contribution
    • Vessel’s Referral Program
    • FAQs
  • 🗺️Smart Contract Deployments
  • 🐚Vessel Community Hub
    • Vessel Community Update: Q1 2024
    • Vessel Community Update: Q2 2024
    • Vessel Community Update: Q3 2024
  • 🎨Brand Kit
Powered by GitBook
On this page
  • ZK-SNARK
  • Vessel Exchange Circuit
  • Compressed Merkle Tree
  • Proof Aggregation
  1. Technical Deep Dive

Prover

PreviousSequencerNextContract

Last updated 9 months ago

Vessel's application supports a range of operations that modify user information and current market status. During execution, the sequencer validates user operations and updates information accordingly, such as adjusting user balances or market liquidity. To ensure the sequencer's correctness, Vessel's prover represents the logic as a circuit and employs zk-SNARK technology.

ZK-SNARK

ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) is a cryptographic technique that ensures the integrity of circuit computation. It enables the service provider to generate a proof of the computation result, allowing the verifier to verify it with minimal computational resources.

In Vessel's architecture, the operation logic is represented as a circuit, and the prover generates proofs of the circuit computation using the witnesses provided by the sequencer. These proofs are generated in parallel to maximize throughput but are committed and verified on-chain in the same logical order as the sequencer processes requests. Once the execution and state changes of a request are encapsulated in a SNARK proof and verified by the on-chain verifier, the request is considered finalized.

Vessel Exchange Circuit

The Vessel exchange circuit functions as a state machine. It compresses the storage of user information and market status using a specialized type of Merkle tree to represent the application's state. At each step, the circuit selects an operation, such as a deposit request or a limit order match, validates the trigger condition, updates the storage, and generates the new state accordingly.

Compressed Merkle Tree

To efficiently maintain the state and verify changes, key-value storage is encoded into a . The primary advantage of this structure is that the on-chain verifier only needs to store the tree root to represent the storage state, rather than the entire key-value table, to verify a proof's validity. This approach allows for recalculating the root for single-state updates with logarithmic costs.

Vessel’s storage is further optimized using a modified Merkle tree called the Compressed Merkle Tree (CMT). Unlike a "full binary tree" initialized with the entire index space, this tree gradually splits nodes and increases depth based on actual usage. This CMT structure significantly reduces resource consumption for proof generation by up to 10 times, given that the entire key space is 256-bit while the practical depth is typically around 20 levels.

Proof Aggregation

Proof aggregation is a technique that consolidates multiple SNARK proofs into a single proof. Given hardware constraints and the gas consumption of on-chain verification, the capacity of a single SNARK proof cannot grow indefinitely. This necessitates the inclusion of proof aggregation mechanisms in the prover’s tech stack.

Proof aggregation offers several benefits:

  • It reduces the gas consumption of the on-chain verifier by decreasing both the number and size of proofs.

  • It allows smaller proofs to be computed in parallel on commodity hardware.

Proof aggregation is an active area of research, with techniques such as recursion and hybrid SNARK & STARK aggregation being explored. Vessel Lab continues to investigate enhanced aggregation schemes for practical applications.

⚙️
Merkle Tree