ZK Chains
ZK chains represent a sophisticated layer of blockchain architecture called a rollup cluster, consisting of parallel-running chains that achieve consensus and finality on Ethereum's Layer 1 (L1) through a shared bridge.
ZK chains are fully interoperable within the Elastic Network, facilitating seamless interactions across chains.
ZK chains operate with a shared bridge contract on Ethereum's L1 and include native bridges between individual rollups, enhancing the overall interoperability and efficiency of the network. Key features of ZK chains include:
- Trustless Validating Bridges: Ensures that rollups within the ZK chain are interconnected without requiring additional trust layers.
- Asset Transfers: Interoperability simplifies the transfer of assets, including burning and minting mechanisms, across the ecosystem.
- Unified Governance: Leveraging a shared governance framework on L1, the ecosystem can coordinate updates or respond collectively to vulnerabilities, much like a traditional blockchain network would handle a fork.
- Security and Trust: All ZK chains must utilize the standardized zkEVM engine to maintain consistent security and operational standards, ensuring that trust and security are derived directly from L1.
Development and Deployment
ZK chains can be developed and deployed by anyone, fostering a diverse and open ecosystem. However, for a ZK chain to remain trusted and fully interoperable within the Elastic Network, it must utilize the ZK Stack. This requirement ensures consistency in execution and security across different instances of ZK chains.
Modular Implementation
ZK chains are designed to be modular, meaning developers can select different components of their blockchain systems or implement their own, with the exception of the zkEVM core. This modular approach allows for customization and flexibility in blockchain development while maintaining core standards necessary for network security and interoperability.
How Interop Works
Interop, or interoperability, is a way to communicate and transact between two ZK Stack chains. It is made possible by smart contracts that verify transactions across chains using Merkle proofs.
It allows you to:
- Observe messages: Track when an interop message (think of it as a special event) is created on the source chain.
- Send assets: Transfer ERC20 tokens and other assets between chains.
- Execute calls: Call a contract on a remote chain with specific calldata and value.
With interop, you automatically get an account (a.k.a.
aliasedAccount
) on each chain, which you can control from the source chain. - Execute bundles of calls: Group multiple remote calls into a single bundle, ensuring all of them execute at once.
- Execute transactions: Create transactions on the source chain, which will automatically get executed on the destination chain, with options to choose from various cross-chain Paymaster solutions to handle gas fees.
Enhanced user experience
Interoperability enhances the blockchain user experience by abstracting complex cross-chain interactions. Users do not need to manually bridge funds to another chain in the Elastic Network if they already have funds on one.
- Reduced Complexity: Users interact with a seamless interface that hides the underlying complexities of blockchain operations.
- Asset Bridging: Relayers manage the process of bridging assets between chains, handling the necessary burning and minting of assets as they move across the ecosystem.
- Lower Fees: By leveraging efficient relayers and minimizing manual operations, transaction costs are kept low, akin to standard gas fees within a single chain.
Real-World Application: Crosschain Transactions
Consider a practical scenario where you want to swap ETH for DAI using a crosschain transaction on a defi platform:
- Transaction Initiation: You initiate the transaction directly from your wallet.
- Relayer Involvement: A relayer picks up your ETH and deposits it into the defi chain.
- Asset Swap: On the defi chain, your ETH is automatically swapped for DAI.
- Completion and Return: The relayer then transfers the DAI back to your original chain.
This entire process is executed as a single transaction, making it feel as seamless as if no chain-switching occurred. The only difference a user might notice is a slightly longer confirmation time, depending on the specific ZK chain used.
Transaction Lifecycle
An interop transaction in the Elastic Network follows these steps:
- Initiation: A transaction is initiated on a ZK chain, aimed at crossing to another chain within the Elastic Network.
- Settlement on L1: The sending ZK chain compiles a cryptographic proof of the transaction and settles it onto Ethereum's Layer 1, anchoring the transaction's validity.
- Transaction Root Update: Ethereum's Layer 1 updates the Transaction Root, a cumulative record reflecting all transactions processed across the Elastic Network.
- Root Importation: The receiving ZK chain imports this updated Transaction Root through its consensus mechanism, akin to the way Layer 1 to Layer 2 messages are currently handled.
- Transaction Submission: A relayer submits the transaction along with a Merkle Proof to the receiving ZK chain. This proof connects the transaction to the newly updated Transaction Root.
- Verification and Execution: The receiving ZK chain verifies the transaction against the Transaction Root. If the verification is successful, the transaction is executed, and the relayer is compensated for their service.
- Proof Settlement: Finally, the receiving ZK chain settles its proof on L1, conclusively validating the transaction within the Elastic Network.
Proof Aggregation
Proof aggregation is a critical component in scaling blockchain technologies, allowing for the efficient verification of transactions across multiple chains.
For ZK Chains, proof aggregation is done via the Gateway.
Gateway
Gateway is a hub for ZK chains proof aggregation. It is part of the critical infrastructure enabling interop between ZK chains.
Gateway enables ZK chains to have:
- Fast interop: Interchain communication requires quick proof generation and verification. The latter can be very expensive on L1. Gateway provides an L1-like interface for chains, while giving a stable price for compute.
- Cheaper Fees: Proof aggregation can reduce costs for users, if there are multiple chains settling on top of the same layer. It can reduce the costs of running a Validium even further.
Once planned upgrades for Gateway are complete, only a lightweight consensus mechanism will be needed, reducing the computational overhead.
Chain Customizations
The ZK Stack offers several customization options for developers looking to tailor a ZK chain to specific needs or create entirely new blockchain architectures. This modular approach allows for significant flexibility in configuring transaction sequencing, data availability policies, and privacy features.
Sequencing transactions
- Centralized sequencer - Utilizes a single operator to quickly confirm transactions, ideal for high-frequency trading (HFT) but requires trust in the operator’s reliability and integrity.
- Decentralized sequencer - Employs a consensus algorithm to determine transaction inclusion, enhancing security and decentralization but potentially at the cost of higher latency. It can be any algorithm, so developers can reuse existing implementations (e.g. Tendermint or HotStuff with permissionless dPoS).
- Priority queue - Allows transactions to be submitted directly via an L2 or L1 priority queue, enhancing censorship resistance, particularly useful for governance protocols. It’s worth noting that the priority queue will always be available as an escape-hatch mechanism (even if a centralized or decentralized sequencer is employed), to protect users against censorship by a malicious sequencer.
- External protocol - Offers freedom to integrate any external sequencing protocols, providing further flexibility and potential integration with existing systems. External protocols such as Shared Sequencers and Shared Builders can be used.
Custom Base Tokens
The ZK stack supports using ERC20 tokens as the base token for chain fees instead of ETH. This enables ZK chains to use tokens like USDC or custom community tokens as the base currency for transactions.
Data Availability (DA)
Data Availability (DA) is a critical component in ensuring the security and functionality of ZK chain. It governs how transaction data is managed and made accessible, impacting everything from user privacy to transaction speed and cost. Below, we detail the various DA options available to developers using the ZK Stack, each tailored for specific security, privacy, and scalability needs.
zk-Rollup
zk-Rollup is the recommended DA policy for most ZK chain. It ensures that the values of every changed storage slot are published as calldata (or blobs, depending on what's cheaper) on Ethereum's Layer 1 (L1). This approach benefits from:
- Amortization of Costs: Changes that net to zero are not posted, reducing unnecessary data and saving costs.
- Inherited Security: Adopts the full security and censorship-resistance properties of Ethereum, providing robust protection against potential attacks.
Validium
A validium offers a more flexible architecture ideal for enterprise applications that require both auditability and confidentiality. Its key characteristics are:
- Controlled DA: The hosting organization controls data availability. Although the funds held in validiums are secure against theft, they can be frozen if the data becomes unavailable. This scenario would not only lock users out of their assets but also potentially damage the reputation and operational status of the hosting organization.
- User-Level Privacy: Validiums enable user-level privacy while giving the chain operator full visibility. Because the host organization controls data availability, it has the power to restrict access.
- Lower Cost: Validiums offer flexibility for operators to save costs when they don't require a high level of security (e.g. a gaming chain).
zkRollup (Self-hosted)
zkRollup (Self-hosted) represents an innovative approach where users manage their own data:
- User-hosted Data: Users store all relevant data for their accounts, significantly enhancing privacy and reducing on-chain data requirements.
- Minimal Data Footprint: Potentially reduces the data footprint to as little as 5 bytes per user interaction, drastically scaling potential.
- Complex Implementation: While offering tremendous benefits, this option requires sophisticated technical solutions to manage user interactions smoothly and securely.
Privacy
ZK chains support various methods to enhance privacy:
- Validium Mode: Naturally provides privacy as long as the data is kept confidential by the operator.
- Privacy Protocols: Specialized L3 protocols like Aztec or Tornado can be integrated to provide user-level privacy while benefiting from ZKsync Era’s features like account abstraction.
- Self-hosted Rollups: Represent a long-term solution for privacy and scalability, where users manage their data and confirm state transitions off-chain.