zkSync Era basics
zkSync Era basics
If you are unfamiliar with rollups, you should cover the rollups basics and read about ZK rollups and Optimistic rollups, before learning about zkSync.
zkSync is a ZK rollup, a trustless protocol that uses cryptographic validity proofs to provide scalable and low-cost transactions on Ethereum. In zkSync, computation is performed off-chain and most data is stored off-chain as well. As all transactions are proven on the Ethereum mainchain, users enjoy the same security level as in Ethereum.
zkSync Era is made to look and feel like Ethereum, but with lower fees. Just like on Ethereum, smart contracts are written in Solidity/Vyper and can be called using the same clients as the other EVM-compatible chains.
You don't need to register a separate private key before usage; zkSync supports existing Ethereum wallets out of the box. At this time, zkSync is solely run and operated by the zkSync team's servers and is therefore centralized. However, this will be transitioned to a decentralized system shortly.
The general rollup workflow is as follows:
- Users can receive, deposit, and transfer assets to each other.
- Users can withdraw assets under their control to an L1 address.
Rollup operation requires the assistance of an operator, who rolls transactions together, computes a zero-knowledge proof of the correct state transition, and affects the state transition by interacting with the rollup contract. To understand the design, we need to look into how zkSync rollup transactions work.
zkSync operations are divided into rollup transactions (initiated inside rollup by a rollup account) and priority operations (initiated on the mainchain by an Ethereum account).
The zkSync rollup operation lifecycles are as follows:
- A user creates a transaction or a priority operation.
- After processing this request, the operator creates a rollup operation and adds it to the block.
- Once the block is complete, the operator submits it to the zkSync smart contract as a block commitment. Part of the logic of some rollup operations is checked by the smart contract.
- The proof for the block is submitted to the zkSync smart contract as block verification. If the verification succeeds, the new state is considered final.
Furthermore, on zkSync, each L2 block will progress through the following four stages until it is final.
Pending: The transaction was received by the operator, but it has not been processed yet.
Processed: The transaction is processed by the operator and is confirmed to be included in the next block.
Committed: This indicates that the transaction data of this block has been posted on Ethereum. It does not prove that it has been executed in a valid way, but it ensures the availability of the block data.
Finalized: This indicates that the SNARK validity proof for the transaction has been submitted and verified by the smart contract. After this step, the transaction is considered to be final.
The typical time for a transaction to go from
Finalized is a couple of hours at the current stage.
Please note that for developer convenience, we usually treat the
Committed states as a single stage called
Committed since they have no difference from the UX/DexEx standpoints.
The State of zkSync
The current version of zkSync Era solves the needs of most applications on Ethereum, and with more features planned for release soon, zkSync Era will provide developers with a design space to experiment with applications not possible on Ethereum today. With this release, we are supporting the following features:
- Native support of ECDSA signatures: Unlike the first version of zkSync and most of the ZK rollups, no special operation is required to register the user’s private key. Any account can be managed in L2 with the same private key that is used for L1.
- Solidity 0.8.x support: Deploy your existing codebase with little to no changes required.
- With small exceptions, our Web3 API is fully compatible with Ethereum. This allows seamless integration with existing indexers, explorers, etc.
- Support for Ethereum cryptographic primitives: zkSync natively supports
- Hardhat plugin: Enables easy testing and development of smart contracts on zkSync.
- L1 → L2 smart contract messaging: Allows developers to pass data from Ethereum to smart contracts on zkSync, providing the required information to run various smart contracts.
Some features are not included in our current testnet that we’re looking to ship in future upgrades, this includes:
- zkPorter: One of the largest and most important features, zkPorter will allow users to choose between a zkRollup account featuring the highest security and a 20x fee reduction compared to Ethereum, or a zkPorter account featuring stable transaction fees of just a few cents in a different security model (much higher than that of a sidechain). Both zkPorter and zkRollup accounts will be able to interact seamlessly together under the hood.
zkSync in comparison
zkSync stands out remarkably in security and usability among existing L2 scaling solutions. Thanks to the combination of cutting-edge cryptography and on-chain data availability, ZK rollups (the core network of zkSync) are the only L2 scaling solution that doesn't require any operational activity to keep the funds safe. For example, users can go offline and still be able to withdraw their assets safely when they come back, even if the ZK rollup validators are no longer around.
- ETH and ERC20 token transfers with instant confirmations and fast finality on L1.
- Transaction fees are extremely low for the mainnet cost for ERC20 tokens and ETH transfers.
- Payments to existing Ethereum addresses (including smart contracts) can be conveniently paid with the token being transferred.
Highlights of zkSync Era
- Mainnet-like security with zero reliance on 3rd parties.
- Permissionless EVM-compatible smart contracts.
- Standard Web3 API.
- Preserving key EVM features, such as smart contract composability.
- Introducing new features, such as account abstraction.
How to get started?
- Begin by building a dApp in the quickstart section.
- See the info on RPC nodes, wallet, and block explorer on the important links page.