zkSync 2.0 is coming. Here are the most complete descriptions of zkEVM and zkSync 2.0
October 13, 2021, Ethernet Square Layer2 solutions zksync developers MatterLabs show a contract with Solidity intelligent and fully functional dApp UniSync Web3 front end, which is MatterLabs use Uniswap V2 intelligent front-end contracts and deployed zkSync 2.0 alpha test network DAPP on the version. Users can receive test tokens to test this dAPP through the uni.zksync.io page.
MatterLabs said that since the launch of the alpha version of the zkSync 2.0 testnet on June 1, the solidity compiler is in a stable state, and the development of the Web3 API with additional Layer 2 specific functions has been completed, and the first EVM-compatible zkRollup has been realized.
MatterLabs also officially revealed that the zkSync 2.0 testnet will be launched soon, and the project party is welcome to settle in through the “zkSync 2.0 Testnet: North Star” plan. This also means that the zkSync 2.0 main network is getting closer.
Golden Finance has compiled the most complete description of zkEVM and zkSync 2.0.
What is zkSync 2.0
zkSync 2.0 is an EVM-compatible ZK Rollup built by Matter Labs and supported by zkEVM developed by Matter Labs.
And zkSync 1.0 has been online payment for nearly 1.5 years, zkSync 1.0
- Reduce the main network transfer cost by about 50 times,
- Completed nearly 4 million transactions,
- 98% of transactions in the last 4 rounds of Gitcoin donations use zkSync
What is zkEVM? Why is it important?
zkEVM is a virtual machine that executes smart contracts in a way compatible with zero-knowledge proof calculations. This is the key to building an EVM-compatible ZK rollup while retaining the actual code and knowledge gained after years of using Solidity. zkEVM retains the EVM semantics, but it is also ZK-friendly and uses the traditional CPU architecture.
The introduction of zkEVM represents an important turning point in encryption technology. Until recently, it was still considered a theoretical possibility, and it would take several years to realize it. But in the past year, the entire zero-knowledge proves that the pace of advancement of the ecosystem has exceeded everyone’s expectations. And thanks to multiple R&D breakthroughs that make zkEVM possible, Solidity programmers can now be the first to have access to the unparalleled scalability, security, and UX advantages of zero-knowledge proof.
What is ZK Rollup?
ZK Rollups is a 2-layer scaling solution that uses proof of validity to expand calculations: each batch of transactions comes with an encrypted proof (ZK-SNARK) verified by an Ethereum smart contract. In this way, all Ethereum full nodes will fully verify every transaction before the block is finalized.
How safe is ZK Rollup?
Among all the expansion solutions, ZK Rollups is the safest, relying entirely on mathematics, thus completely inheriting the safety of L1, which is essential for its function in a highly adversarial environment. In contrast, other extended solutions rely on financial guarantees or third parties, and therefore provide much weaker security attributes.
The verification of state changes in ZK Rollups is done by calculating zero-knowledge proofs: if any state change is invalid, no proof can be generated, which in turn means that the entity verification cannot include invalid state changes. This is why we call them sequencers rather than validators: they do not verify transactions, and Ethereum smart contracts rely on pure mathematics to verify. We don’t need to trust them or monitor their fraud, because they cannot commit any fraud.
How scalable is ZK Rollup?
ZK Rollups can provide up to 2000 TPS under peak load, but it will get better.
ZK Rollups is also the only L2 that can provide an order of magnitude expansion of a system, and zkPorter can provide up to 20,000 TPS.
What is zkPorter?
zkPortor puts data availability-the basic transaction data needed to rebuild state-off-chain instead of on Ethereum. Instead, the zkSync token pledger’s proof of stake is used to protect data availability. This achieves higher scalability (tens of thousands of TPS), thereby achieving ultra-low transaction fees (a few cents) comparable to side chains.
The security of zkPorter is still better than any other L1 or side chain. In the worst case, where malicious actors control the sequencer and more than 2/3 of the total equity, they can sign valid state transitions but retain the data. In this case, the status is “frozen” and the user will not be able to log out, but the attacker’s stake is also frozen. Therefore, an attacker with a large amount of rights has no direct way to obtain financial benefits from exploiting the vulnerability.
What is transaction finality in zkSync?
The sequencer will provide fast off-chain confirmation for transactions. This kind of confirmation is semi-trusted: the sequencer cannot trigger invalid status updates (such as stealing funds), but may still be unable to include transactions after confirmation, or reorder transactions within a short period of time.
When a zero-knowledge proof is generated and published to Ethereum, the transaction is considered the final transaction. Depending on the activity, this may take from 15 minutes to 3 hours.
Comparison with other expansion plans
What is the main difference between zkSync 2.0 and optimistic rollup (eg Arbitrum , Optimism)?
1) Significantly higher security
ZK rollup eliminates the dependence on the watcher and replaces the economic security of game theory with cryptographic security-you believe in pure mathematics rather than incentivizing participants.
2) Higher financial efficiency
In OR, the native withdrawal of any asset takes a long time (best case: 1 week). This is a safety parameter that cannot be reduced without exponential decline in safety.
For homogenized tokens, this problem can be alleviated by having a lot of idle liquidity on the other side of the bridge. In order to compensate for the opportunity cost of funds, users need to pay for bypassing the waiting period.
For smaller funds, this may be acceptable, but for professional traders, this already constitutes a huge cost and will be reflected in their profit margins. For institutions that need to transfer large amounts of liquidity (billions) between L1 and L2 on a regular basis, this solution is not efficient, because liquidity providers are unlikely to let so many funds idle.
3) NFT user experience
NFT’s native withdrawals cannot be accelerated-liquidity provider solutions are not applicable because NFTs are unique. Therefore, to withdraw the NFT, the user must really wait for 1 week or more.
In zkSync, any withdrawal will be completed within 15 minutes to 3 hours. When there are more activities, the withdrawal time will be faster.
4) Transaction costs
For most popular encryption use cases, ZK Rollups is cheaper because it requires the least amount of data published on the chain (no signatures and transaction parameters).
However, for some common use cases, the order of magnitude of cost savings is much greater. Specifically, ZK Rollups only needs to post the final changes to the state, and since many transactions enter the same storage slot, the cost can be amortized. For example, the data availability cost of all transactions and oracle update transactions in the same block is zero.
Finally, zkSync 2.0 will have an extension called zkPorter, which will provide a fixed transaction fee of 1-3 cents by placing data off-chain. Optimistic rollup fundamentally cannot have such an extension of the availability of off-chain data, because without public data, observers cannot verify the validity of each transaction. Therefore, it is impossible for them to provide such a hybrid system to users who prefer ultra-low cost over security.
How does using zkSync compare with side chains (such as Matic /Polygon, BSC, Solana, Avalanche)?
The Ethereum sidechain is a separate L1 with its own security mechanism and a bridge between it and Ethereum. Sometimes the bridge validator is the same as the sidechain validator and uses the same staking mechanism (for example, in the case of Polygon/Matic PoS).
The most important point on this topic is that no matter how the sidechain itself is protected, when it is used as a scaling solution, the security of assets always depends on the goodwill of most bridge verifiers. If most people are compromised, they can steal all assets irreversibly. Since most bridges operate in a DPoS model under low-latency consensus requirements, most stakes are usually controlled only by a few validator servers physically located in the same data center. The risk of all these servers being compromised is very important, and not just a theoretical threat.
zkSync 2.0 provides its users with two account types: ZK Rollup and zkPorter. Compare each of them:
1) ZK Rollup and side chain
ZK Rollup provides the same level of security as L1 itself, but at a higher cost (about 1/50 of the cost of L1). On the other hand, side chains rely on the assumption of an honest majority to achieve much lower fees.
2) zkPorter and sidechain
zkPorter provides ultra-low costs similar to side chains, but the security is improved by an order of magnitude.
zkPorter relies on Ethereum to ensure the validity of transactions, and relies on zkSync token staking to ensure data availability.
In the worst case, where malicious actors control the sequencer and more than 2/3 of the total stake, they can sign valid state transitions but retain the data. This will freeze the state, users will not be able to withdraw, but the rights and interests of the attacker will also be frozen.
This is still a stronger guarantee than the side chain, because no hacker can be directly exploited, and there is no economic benefit to be hacked. In addition, guardian nodes can run on consumer-level hardware, so they do not require DPoS. This means a higher degree of decentralization, which leads to higher digital security: hackers may need to destroy hundreds or even thousands of guard nodes to control most of the equity stake.
No matter which zkSync account type the user chooses, it will be much safer than the side chain. ZK Rollups will provide the highest security, while zkPorter will provide comparable costs. In any case, all users will be able to interact seamlessly with each other, thereby forming a larger liquidity pool.
What it means for developers
Does zkSync support Solidity smart contracts?
Most DeFi and NFT projects can run without code changes. However, in the first version, calls to SHA256 and Keccak256 will be automatically replaced by the compiler with circuit-friendly hash functions. Other encryption primitives, such as ecrecover and encrypted precompilation, are not currently supported.
How does the UI interact with smart contracts? Can the current front end be reused?
You can fully interact with smart contracts and the zkSync network through our Web3 API and Ethers SDK:
- For read requests: any web3-compliant framework in any language can be used out of the box and has additional optional zkSync L2 specific features.
- For write requests (send transactions): Due to the fundamental difference between L1 and L2, you will have to write some additional code (for example, zkSync supports payment in any token, so sending a transaction will involve choosing a token to pay the fee).
So yes! Developers can reuse the current front-end with only a few changes (sending transactions are different).
How do users submit transactions? Which wallets are supported?
For the interaction with the smart contract, the user will use the hash value of calldata to sign the EIP712 message. Since EIP712 is based on the native Ethereum signature, all wallets, even hardware wallets, can run without any extensions.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/zksync-2-0-is-coming-here-are-the-most-complete-descriptions-of-zkevm-and-zksync-2-0/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.