Protocol Architecture

The ZeroLayer protocol is built upon a robust and elegant architecture designed for security, efficiency, and decentralization. It can be broken down into three distinct layers, each with a specific responsibility.

1. Client Layer

The Client Layer is what users interact with. It is a web application that runs entirely in the user's browser. This layer is responsible for all user-facing activities and cryptographic operations.

  • Wallet Integration: Connects to user wallets like MetaMask to authorize transactions.
  • Key Management: Securely derives the user's privacy key from a signature and manages it locally.
  • State Management: Scans blockchain events to build and maintain a local copy of the protocol's state (the Merkle tree) and the user's private notes.
  • Cryptography: Generates stealth addresses for recipients, encrypts and decrypts transaction notes, and, most importantly, creates the zero-knowledge proofs required for all private operations (Shield, Transfer, and Unshield).

Because all sensitive operations happen on the client-side, the user's keys and unencrypted data never leave their device, ensuring a non-custodial and trustless experience.

2. Contract Layer

The Contract Layer is the on-chain component of the protocol, consisting of smart contracts deployed on EVM-compatible blockchains. This layer acts as the ultimate source of truth and the impartial verifier for the entire system.

  • State Storage: It stores the protocol's state in a condensed and efficient manner, primarily the roots of the Merkle trees and the set of all spent nullifiers.
  • Proof Verification: Its most critical function is to verify the zero-knowledge proofs submitted by users. It uses specialized Verifier contracts to check the mathematical validity of the proofs for each type of transaction.
  • State Transition: If a proof is valid, the contract updates its state according to the public outputs of the proof (e.g., updating the Merkle root and recording new nullifiers).
  • Asset Management: It holds the public ERC-20 tokens that have been "shielded" and is responsible for releasing them during the "unshield" process.

The smart contracts are designed to be as simple and secure as possible. They contain no complex cryptographic logic themselves; they only verify the proofs generated by the client.

3. Circuits Layer

The Circuits Layer is the cryptographic heart of ZeroLayer. A "circuit" is a program that defines the rules and constraints for a specific operation, which is then compiled into a form that can be used to generate and verify zero-knowledge proofs.

ZeroLayer has a dedicated circuit for each core operation:

  • Mint Circuit: Defines the rules for shielding tokens (e.g., the value of the new note must match the public deposit).
  • Transfer Circuit: Defines the rules for private transfers (e.g., input notes must be valid, their values must sum to the output values, and nullifiers must be correctly computed).
  • Rollover Circuits: Special circuits that handle the "rollover" of the Merkle tree to maintain efficiency.

These circuits are the ultimate guarantee of the protocol's integrity. They mathematically enforce the rules of the system, ensuring that no one can create money out of thin air, spend the same note twice, or violate any other protocol constraint, all while keeping the transaction details completely private.

results matching ""

    No results matching ""