What is zkSync Era? The Developer's Guide (2024)

What is zkSync Era? The Developer's Guide (2024)

Zero-knowledge (ZK) is an area of growing interest in the blockchain space. Especially, the Ethereum community is striving to employ ZK in the pursuit of solving two key issues of the Ethereum blockchain — privacy and scalability.

The core of ZK's promise lies in its zero-knowledge proofs (ZKPs). These proofs enable the verification of data without exposing the underlying information. In the context of blockchain, ZKPs offer a way to scale networks efficiently. They achieve this by processing transactions off-chain, yet preserving the security guarantees of on-chain operations. 

Additionally, ZKPs maintain the integrity of data in decentralized networks. 

Talking about ZK efforts, zkSync Era is a leading project in the zk-rollup field that has processed over 19 million transactions in the past 30 days. It uses ZKPs to provide scalable and low-cost transactions on Ethereum. 

In this blog post, we will explain what zkSync Era is, how it works, and how you can build on zkSync Era.

What is zkSync Era?

zkSync Era is a Layer 2 scaling solution for Ethereum. It employs zk-rollup technology to bundle multiple transactions into a single proof, processing them off-chain, significantly boosting Ethereum's transaction throughput. It allows Ethereum Virtual Machine (EVM) dapps to be ported effortlessly to zkSync Era, offering them higher transaction throughput while maintaining Ethereum's security and decentralization.

As a rollup, the majority of computation is performed off-chain in zkSync Era i.e. the complex transaction processing and smart contract executions are handled outside the Ethereum mainnet. This significantly reduces the computational load on the mainnet

After the transactions are processed off-chain, ZKPs are generated to ensure computational integrity and validity. These proofs are then submitted to the Ethereum mainnet.

Most of the data associated with transactions in zkSync Era is also stored off-chain. This reduces the load on Ethereum since only essential data like state roots, transaction block commitments, and zero-knowledge proofs are stored on-chain.

More importantly, zkSync Era is also EVM-compliant since it supports Ethereum's smart contracts and assets, providing a seamless experience for users and developers.

How zkSync works?

Here is a quick breakdown of how zkSync works in terms of transaction lifecycle and block stages.

Transaction Lifecycle in zkSync Era:

Creation: A user initiates a transaction or a priority operation.

Processing: The operator processes this request, creating a rollup operation and adding it to a block.

Commitment: Once the block is complete, the operator submits it to the zkSync smart contract as a block commitment. The rollup operation logic is checked by the smart contract.

Verification: The proof for the block is submitted to the zkSync smart contract as block verification. Successful verification finalizes the new state.

Block Stages:

Pending: The transaction is received by the operator but not yet processed.

Processed: The transaction is processed and confirmed for inclusion in the next block.

Committed: The transaction data of this block has been posted on Ethereum, ensuring data availability.

Finalized: The SNARK validity proof for the transaction is submitted and verified. The transaction is then considered final.

zkSync Era operator

The role of the operator in the zkSync Era is pivotal to its functioning. From managing the processing of transactions, creation and commitment of blocks, to the generation and submission of zero-knowledge proofs, the operator is a central figure for the functioning of the zkSync Era engine.

Moreover, operators are responsible for maintaining the network's integrity and security. They must ensure that transactions are processed correctly and efficiently and that the network remains robust against potential threats or malfunctions.

Deploy smart contracts & build web3 apps on zkSync Era:

zkSync: RPC and Chain Settings
Use the best zkSync RPC and add to your wallet. Discover the chain ID, native token, explorers, and more.

zkSync Era and EVM compatibility

According to Vitalik Buterin, EVM compatibility can be segmented into four types. zkSync is categorized as a Type 4 system in the taxonomy of zkEVMs.

Type 4 systems of EVM compatibility work by taking smart contract source code written in high-level languages (like Solidity or Vyper) and compiling it to a language designed to be zk-SNARK-friendly. 

Talking about zkSync Era in specific, it supports smart contracts written in Solidity or Vyper. It uses custom compilers, namely zksolc for Solidity and zkvyper for Vyper. These compilers are tailored to work with the zkSync VM, ensuring compatibility and efficient execution of smart contracts.

More importantly, zkSync Era provides developers with a smooth experience, offering tools for testing locally and compatibility with existing frameworks like Hardhat and Foundry.

Advantages of zkSync Era

Type 4 systems, like zkSync, have very fast prover times. 

Type 4 systems prioritize performance by bypassing the need to Zero-Knowledge prove every aspect of EVM execution. Instead, they start directly from higher-level code.

zkSync, as a Type 4 system, prioritizes performance and provability in ZK. 

Disadvantages of zkSync Era

This approach leads to more incompatibility compared to systems that closely replicate the EVM. 

For instance, contracts may not have the same addresses as they do in the EVM, and handwritten EVM bytecode is more difficult to use.

To sum this up, zkSync Era is EVM-compatible, meaning it supports a significant portion of Ethereum's EVM opcodes, allowing most smart contracts to work seamlessly. However, it's not EVM equivalent, as it doesn't support every opcode down to the bytecode level.

How does zkSync benefit developers?

zkSync offers several novel features to help developers like:

Solidity 0.8.x support

The support for Solidity 0.8.x in zkSync Era allows developers to deploy their existing Ethereum codebase with minimal changes. 

This compatibility significantly lowers the barrier for Ethereum developers to migrate to zkSync — facilitating a smoother transition and integration of existing projects.

Native account abstraction

zkSync Era's implementation of native account abstraction brings multiple user experience improvements. It allows for programmable authorizations, leading to more flexible and secure wallet designs — such as smart contract wallets with social recovery and multisig capabilities. 

Additionally, it allows for non-cryptographic modifications like transaction expiry times and out-of-order confirmations, enhancing the usability and security of transactions.

L1 → L2 Smart contract messaging

Thias feature now enables two-way communication between an L1 (Ethereum) and L2 ( zkSync). It allows for the relay of information from zkSync back to Ethereum, enabling actions like triggering smart contracts based on events that occur in L2. 

This opens up several possibilities like web3 games can have their gaming on an L1 but a secondary marketplace for their in-game assets like weapon skin NFTs on an L2.

Is zkSync Era the solution for Ethereum scalability?

zkSync Era is a key player in solving Ethereum's scalability challenges via the zero-knowledge route. Its technical architecture, coupled with a proactive developmental cycle holds the project in good stead as compared to peers.

Its most-awaited extension zkPorter, an off-chain data availability solution, is in the works by Matter Labs, the brains behind zkSync. By keeping transaction data off-chain, zkPorter is set to greatly reduce the cost and increase the scalability of transactions. 

Moreover, zkPorter is expected to be a part of the Volition solution class — which focuses on providing users the choice between on-chain and off-chain data availability. 

While all this requires our patience, building dapps on zkSync doesn’t need any wait. Developers can use a suite of smart contracts that thirdweb offers specifically for zkSync Mainnet. From NFT airdrop contract to staking contracts for ERC20 token, everything a developer needs, thirdweb offers.

Here is a video tutorial on how to build a dapp on zkSync.

zkSync: RPC and Chain Settings
Use the best zkSync RPC and add to your wallet. Discover the chain ID, native token, explorers, and more.

If you have any questions, join 44,000+ other builders in our Discord community — or reach out to the team directly for more info on how to get started with blockchain development on zkSync Era.

And if you want to start building dapps on zkSync Era, get started with thirdweb's web3 tools & SDKs — they're free.