Matter Labs created zkSync, a trustless scaling solution for Ethereum powered by ZK-Rollup technology. If you’ve been transacting on Ethereum lately, then you already know how congested the network has become and how expensive the gas fees are. Layer-2 solutions like zkSync are crucial to fixing these issues.
zkSync promises low transaction fees, and it’s trustless. Furthermore, users’ funds are as secure as they are on the Ethereum mainnet. Since scaling is one of the most viable ways to push mainstream adoption of public blockchains, zkSync will help the team at Matter Labs reach their goal of accelerating this financial revolution.
In this article, we’ll cover Matter Lab’s mission and dig deeper into the technology that drives zkSync. However, if you need to brush up on Layer 2 before reading this, please check out our article “Comparing Layer-2 Ethereum Scaling Solutions.” Or, if you’re new to crypto altogether, head over to Ivan on Tech Academy and take the Crypto Basics Course.
Matter Labs’ Mission
The founders of Matter Labs, Alex Gluchowski, a software engineer, and Alex Vlasov, a Ph.D. in high-energy physics, hold freedom as a core value and embrace a powerful mission for the company. More freedom, they believe, is the key to solving many of the world’s problems such as poverty, equality of opportunity, and personal wealth creation.
They seek to give users complete control over their finances. So, freedom and “access to finance for all” is the mantra that can become a reality by accelerating the mass adoption of public blockchains.
Cryptography is vital to achieving such freedom. That’s because it is the technology that empowers the individual to resist rich and powerful global adversaries. Developing cryptography led to the creation of permissionless blockchains and brings financial sovereignty to the individual for the first time in human history.
That’s what Matter Labs is all about—tackling exciting technological problems so complex that it pushes their collective minds to the edge.
Matter Labs – Speed to Market vs. Security
Speed is critical because the Matter Labs team believes that regulators will impose a “compliance hell” on crypto, similar to the traditional banking system if they don’t move fast enough. While regulators won’t stop the digital revolution ultimately, they are still capable of impeding the public’s adoption before crypto can reach escape velocity.
Hence, the team tends toward the “perfection is the enemy of progress” side of things. They don’t want perfection standing in the way of quick and frequent releases. Matter Labs is always looking for ways to ship faster without compromising security and code reliability since they know that any undisciplined coding errors can result in frozen or stolen funds, which means “mission failure.”
Crypto can be a harsh, adversarial environment. It’s a dark forest full of talented hackers who are experts at attacking smart contracts—even ones that have passed smart contract security audits. So, with all the focus on speed, the team is also wary of the challenges, and they expect the attackers to be limitlessly intelligent.
To learn more, check out the Ethereum Smart Contract Security course at Ivan on Tech Academy.
So, to accelerate adoption, Matter Labs is building excellent products quickly that will convince people to switch to crypto. To accomplish all of this, Matter Labs is working on a single solution, zkSync, a decentralized Layer-2 scaling protocol secured by zero-knowledge proofs.
Matter Labs calls zkSync “Ethereum’s most advanced ZK-Rollup,” and it’s already live on the Ethereum mainnet. zkSync is pursuing the path of progressive decentralization to accelerate individual financial sovereignty. It also brings strong censorship resistance to Layer 2 and is capable of making quick and inexpensive transfers.
Matter Labs has had zkSync in production since the summer of 2020 – the current scope includes providing low gas transfers of tokens on Ethereum. It already reduces gas fees to a small fraction of Layer 1, but zkSync wants to go further and unlock a PayPal type of scale.
zkSync is also DEX-friendly, and since atomic swaps are an essential part of exchange protocols, these will soon go live on zkSync.
Matter Labs created zkSync to scale Ethereum by relying on math rather than complex incentive schemes that adversaries can trick. That’s why they chose zero-knowledge proofs. Thankfully, Matter Labs is one of a few companies with the necessary expertise in the field to pull this off.
Some of zkSync’s features include:
- Layer-1 level security with no third-party reliance.
- Instant confirmations on Layer 1 for ERC-20 tokens.
- Low transaction fees ~1/100th of Ethereum mainnet fees.
- ~10 minute wait time on withdrawals to mainnet.
zkSync Under the Hood
Now that we know some of what zkSync can do, let’s look under the hood.
zkSync and Zero-Knowledge Proofs
A zero-knowledge proof comes from the world of cryptography. It’s a method where one party (the prover) sets out to convince the other party (the verifier) that a number “x” exists and that it knows the value of x without telling the verifier exactly what x is. Zero-knowledge proofs can get complex, so for now, think of it as a challenge to prove possession of information without revealing what the information is. zkSync uses these proofs to scale Ethereum.
zkSync and zk-SNARK
zk-SNARK is an acronym for “Zero-Knowledge Succinct Non-Interactive Argument of Knowledge.” In the earlier versions of zero-knowledge protocols, the prover and verifier went back and forth, communicating multiple times. However, with “non-interactive” constructions like SNARKs, the proof only needs to look at a single message from the prover to the verifier. At present, non-interactive constructs are the most efficient way to produce zero-knowledge proofs.
We won’t be going into ZK-Rollups and SNARKs much in this article, but for a good introduction, please read our article, “Breaking Down ETH 2.0 – zk-SNARKS and zk-Rollups.”
You can also enroll at Ivan on Tech Academy and take the Ethereum 101 course to get a solid foundation on Layer 1 before diving into Layer-2 technologies.
zkSync and ZK-Rollups
Matter Labs chose ZK-Rollups as zkSync’s core technology because, among other things, ZK-Rollups combine cutting-edge cryptography and on-chain data availability.
ZK-Rollups can roll up thousands of transactions into a single block which is a massive time saver. The mainchain holds the user’s funds, while computation and storage move off-chain. Further, the mainchain contract generates and verifies a state transition zero-knowledge proof for every rollup block.
ZK-Rollup architecture guarantees that:
- The Rollup validator cannot corrupt the state or steal tokens, which is its advantage over Sidechains.
- Users are not at risk if validators stop cooperating. They can still retrieve funds from the Rollup, which is its advantage over Plasma.
- Monitors do not need to be online to watch rollup blocks and prevent fraud, unlike payment channels or Optimistic Rollups.
ZK-Rollups inherit the security guarantees of Layer 1, and zkSync uses zero-knowledge proofs to keep user’s funds safe.
How zkSync Works
Now we’ll look at how everything works together in zkSync.
A smart contract on the mainchain holds the funds for starters, while storage and computation move off-chain. Storing the state off-chain is far less expensive than keeping it on-chain.
The transactions get rolled up into a rollup block, verified, and approved simultaneously. Rolling them up is a big time saver as opposed to confirming each transaction individually.
So, users sign and submit transactions to validators. The validators roll up multiple transactions into a single block. Next, the validators submit a cryptographic commitment of the new state to the mainnet along with a proof. The commitment says that this new state is the result of correct transactions applied to the old state.
The proof and the state are published over the mainchain as calldata. This action empowers anyone to reconstruct the state at any moment. The smart contract verifies the proof and the state, confirming the transactions’ validity in the block and block data availability.
zkSync Transaction Speed and Finality
zkSync processes over 2000 transactions per second (TPS) currently, and the transactions reach finality once the smart contract on the mainchain accepts the SNARK proof from the zkSync block. At present, zkSync does not generate the proof immediately. Whenever a user sends a transaction, it waits until the block gets filled.
The zkSync proof time generation is approximately 10 minutes after it’s submitted, and the transaction is as final as any on Layer 1. Although finality time is about 10 minutes, it does not affect the network usability. User transactions are instantly confirmed and displayed to the receiving party. Even though they’re unconfirmed, the transferred assets are immediately available for further transfers.
Presently, instant confirmations are promises that zkSync validators make to include the transaction in the next block. The validators run a consensus that provides a sub-second confirmation that the next zkSync block will contain the transaction. A supermajority of more than 2/3rds of the consensus participants weighted by stake must sign off on it. For users who don’t trust the validator, they should wait for finality before counting the assets as received.
zkSync vs. Optimistic Rollups
In comparison, zkSync is much quicker than Optimistic Rollups with their fraud-based scaling solutions that require at least a one-week lockout period to finality. Even so, Matter Labs and other zero-knowledge-proof projects are always trying to accelerate the prover efficiency.
Furthermore, in extreme circumstances, cascading failures like Maker DAOs Black Thursday event is especially bad for fraud-proof-based scaling solutions like Optimistic Rollups.
That’s because their automated security bots cannot get fraud-proof transactions mined during high congestion attacks. This kind of situation can jeopardize all the assets under the control of such systems.
In contrast, zkSync thrives in high-congestion environments. A congested network situation like a DOS attack cannot pose a threat to its assets. Funds moving in or out of zkSync require a zero-knowledge proof of validity Layer 1 censorship does not affect them.
Users Funds on zkSync
The protocol has an emergency exit mechanism that ensures users control their assets even during unforeseen events where all validators shut down. In normal operations, validators have a short time window, and if they fail to process requests, the system dives into exodus mode. When that happens, users can immediately exit with their funds directly on the Ethereum mainnet.
zkSync and Gitcoin
As far as real-world examples go, Gitcoin recently integrated support for zkSync. If you haven’t heard of Gitcoin, it’s known for Gitcoin Grants rounds, where projects can crowdsource fundraising and get matching donations and quadratic funding. zkSync’s payment option has already proven popular. For example, in Gitcoin Grants Round 9, zkSync facilitated over 80% of all donations.
Future Changes to zkSync
Future changes are coming to zkSync, however. For one thing, elected validators will have to post a significant security bond to the zkSync smart contract on mainnet if they want to participate in block production.
Once a new zkSync block goes to the mainchain, no one can reverse it. However, if the block does not contain the transactions as promised, the signer’s security bond gets slashed. Only malicious validators get punished in such situations, with a portion of the slashed funds going to the affected transaction recipient as compensation.
Also, coming soon, users can add new tokens in a permissionless fashion as long as CoinMarketCap.com tracks the price and daily trading volume exceeds $1 million over the past three months.
zkSync 2.0 and zkPorter
Other future changes are coming as well. Most notably is the massive improvements in TPS with version 2.0. zkSync 2.0 is coming to mainnet in the next six months and what makes it exciting is the estimates of over 20,000 TPS while still offering more security than Optimistic Rollups.
As we’ve discussed, users, projects, and protocols are all set for mass migration from the Ethereum base layer to Layer 2 rollups to avoid network congestion and high gas fees. While rollups promise some welcome relief, with Optimistic Rollups offering a 25x increase in scalability and ZK-Rollups a 100x increase, some insiders working on these solutions believe the relief will only be temporary.
That’s because they see any increase in throughput getting gobbled up by increased demand on Ethereum. Therefore true scalability can only come through exponential gains in throughput. This scalability gap is what motivated the team at Matter Labs to build zkPorter.
With zkSync’s latest evolution, the Layer 2 state gets divided into two parts:
- ZK-Rollup with on-chain data availability and
- zkPorter with off-chain data availability
We’ll likely get into the intricate nuts and bolts of version 2.0 in a later article. But for now, the critical feature to note is the massive increase in TPS from 2,000 to 20,000.
Matter Labs and zkSync – Conclusion
All in all, compared to existing Layer-2 scaling solutions, zkSync ranks high in usability and security. It’s also shown positive, real-world results with Gitcoin. Now, with zkPorter looming on the horizon and DeFi continuing to grow in popularity, other exciting use cases are bound to come into play.
Do you want to become an expert in building Layer-2 solutions? First, you’ll need to learn blockchain development, and the best place to do that is at Ivan on Tech Academy. Start your education today!