Solidity & Beyond: Zero-Knowledge Proofs

Phyzixmusic
Hexmount
Published in
5 min readJul 29, 2023

zkSync, roll-ups and all the good stuff explained!

Photo by Nejc Soklič on Unsplash

Zero-knowledge proof is an encryption scheme whereby one party (the prover) can prove the truth of specific information to another party (the verifier) without disclosing any additional information.

Although this might sound like some fancy advanced blockchain topic. ZKPs methodologies have been around for awhile, way before the invention of decentralised ledgers. They were introduced by some clever folks at MIT. In this article, we will review the details of ZKPs and how to implement them. You should have a basic understanding of tokens, EVM and all basic blockchain knowledge.

Zero Knowledge Poof

The methodology is more simple than it sounds. All zero-knowledge proofs include three essential prerequisites:

  • Completeness: if a statement is true then the verifier can certify the prover possesses the required input.
  • Soundness: the statement cannot be falsified, and the verifier cannot be convinced the prover has the required input when they do not.
  • Zero-knowledge: the verifier will not be able to know any information beyond the statement being true or false. Details of the information and personal data of the other parties stay anonymous.

This has some key pros & cons:

Pros:

  • Simplicity — Does not require any complicated encryption methods.
  • Privacy — Increases the privacy of users by avoiding the reveal of personal information in public blockchains.
  • Security — Strengthens security of information by replacing ineffective authentication methods.
  • Scalability — Increases blockchain throughput and scalability.

Cons:

  • Limited — The protocols for ZKP’s usually rely on mathematical equations and numerical answers. Any other method requires a translation.
  • Requires a large amount of computing power — There are around 2000 computations per ZKP transaction that each require a certain amount of time to process.
  • Restricted — If the originator of a transaction forgets their information, all the data associated with it is lost.
  • Vulnerability Potential vulnerability to advanced technologies like quantum computing.

What is zkSync?

Recently there’s been some interesting research on using zero-knowledge proofs to secure token transfers between Ethereum and side-chains, and there’s now a practical implementation of this research in the form of zkSync from Matter Labs.

zkSync is built on the ZK rollup architecture, a level-two scaling solution in which all funds are held by a smart contract on Ethereum, while computation and storage are performed off-chain.

Why should you care about zkSync?

This is the short answer to why we think zkSync is important:

  • The protocol allows ETH and ERC20 token transfers with instant confirmations and 10 min finality on Ethereum.
  • Provides Mainnet-level security with zero reliance on 3rd parties.
  • Low transaction fees
  • Fast deposits and withdrawals

How does zkSync work?

In a nutshell, users can send their ETH or ERC20 tokens to the zkSync smart contract on Ethereum, and the protocol will credit them with the equivalent assets. For simplicity, this article will only cover how you can make ETH payments.

zkSync relies on a smart contract deployed to the Ethereum network to hold all assets, while most computations are performed off-chain. Every time you sign a transaction, the protocol submits it to operators who roll up multiple transactions (potentially thousands) into a block, and compute the following:

  • cryptographic commitment (root hash)
  • cryptographic proof (the SNARK)
  • state ∆, representing a small amount of data for each transaction

All this stuff is then sent to the smart contract running on the Ethereum network. This enables an interested party to reconstruct the state at any given point in time.

The SNARK verification is significantly cheaper than verifying every transaction individually, and storing the state off-chain is also much cheaper than storing it in EVM. This enables a boost in scalability and transaction cost savings.

Importance of Zero Knowledge Proofs in Decentralised Finance

It’s crucial to understand why zero-knowledge proofs (ZKP) matter, especially in the realm of decentralised finance (DeFi). DeFi refers to blockchain-based protocols that enable various financial services, such as loans, insurance, trading, and more, without needing traditional banks or intermediaries.

These platforms are transparent and operate on public blockchains. However, this transparency often comes at the expense of privacy. With all transactions and balances being publicly available, it’s not hard for someone to link an identity to a particular blockchain address. This is where ZKP comes in.

Zero-knowledge proofs allow users to prove that they hold a specific piece of information or have completed a particular action without revealing any details about the information itself. In a world where data is a valuable asset and privacy is increasingly scarce, ZKP offers a promising solution for maintaining privacy in a decentralized, transparent world.

ZkSync’s Impact on Ethereum’s Scalability

The scalability of a blockchain is its capacity to handle a large number of transactions per second (TPS). The more TPS a blockchain can handle, the more scalable it is. The Ethereum blockchain has a notoriously low TPS, which is a considerable bottleneck for the platform.

ZkSync addresses this scalability issue by moving most of the computational work off-chain. This means that while the assets remain on the Ethereum mainnet, all the transaction computations are performed off-chain, thus reducing the load on the Ethereum network.

By doing so, zkSync has significantly improved the scalability of Ethereum. With zkSync, the Ethereum network can handle more transactions per second, reducing congestion and lowering transaction fees.

Security in zkSync: Trustless Custody

One of the essential features of zkSync is that it provides trustless custody. The term “trustless” means that users don’t have to trust or rely on third parties to handle their assets securely. This is achieved by using a smart contract on the Ethereum mainnet that holds all funds.

Even though computation and storage are off-chain, all assets remain on the Ethereum mainnet, secured by its robust consensus mechanism. This makes zkSync a trustless system, as users retain control over their funds without needing to trust a third party.

Developing on zkSync: zkSync SDKs and APIs

f you’re a developer looking to build on zkSync, Matter Labs provides a variety of Software Development Kits (SDKs) and APIs that make it easier to interact with zkSync.

These tools provide a seamless way to integrate zkSync into existing applications or develop new ones that leverage the scalability, security, and privacy benefits of zkSync. For example, the zkSync Ethereum library allows developers to send transactions, query balances, and more, all while benefiting from the advantages of zkSync’s ZK rollup architecture.

The Future of Zero-Knowledge Proofs and zkSync

The adoption and integration of ZKPs and platforms like zkSync have demonstrated the technology’s potential to revolutionise the future of DeFi. Their implementation has addressed critical issues in blockchain networks, like privacy, security, and scalability, that were previously seen as obstacles to mainstream adoption.

As we continue to innovate and develop within the blockchain space, the potential applications for zero-knowledge proofs and layer-two solutions like zkSync become even more exciting. With these tools in hand, we are set to see a future where decentralised finance becomes a more viable, scalable, and secure alternative to traditional financial systems.

With the importance of privacy and scalability in the blockchain sector, zkSync and similar technologies will undoubtedly play a pivotal role in the future of blockchain and DeFi. The potential applications are endless, and we are just scratching the surface.

--

--