📜State of Zero-Knowledge

📜State of Zero-Knowledge

2023 Feb 21 See all posts


Originally published on Paragraph.

Zero Knowledge cryptography is one of the most hyped sub ecosystems in web3 , you can be at any conference and someone spelling zk suddenly seems to be the serious guy but there are many different aspects of how it’s being used in scaling & making Ethereum more privacy-centric.

What is ZK?

Zero-knowledge cryptography is a type of cryptography that uses hash functions and cryptography schemes to prove some truth to a party as the name suggests without revealing the truth itself.

How is this possible you ask? Let me give you a simple example. Say I give you a card and say it’s a red one, and to prove that I take 26 black cards out of the deck. now I didn’t show you the card itself but did an operation that made you believe I was telling the truth.Now maybe another example let’s say I am drinking rn(I don’t) and someone asks for my id proof and I show them my marriage certificate. Note that in India the legal marriage age is the same as the drinking age for boys which proves that I am eligible to drink. (sorry for the dumb example)

  <div class="youtube-player" style="background-position: center;">
    <a href="https://www.youtube.com/watch?v=HUs1bH85X9I">
      <img class="play" src="https://api.paragraph.com/blogs/rss/{{DOMAIN}}/editor/youtube/play.png" />
    </a>
  </div></div><p>Zk was first introduced by two researchers in the paper &quot;<a class="dont-break-out" href="https://people.csail.mit.edu/silvio/Selected%20Scientific%20Papers/Proof%20Systems/The_Knowledge_Complexity_Of_Interactive_Proof_Systems.pdf" rel="noopener noreferrer nofollow ugc" target="_blank">The Knowledge complexity of interactive proof systems&quot;</a> and since then it has become a promising area of development for researchers but rn we will talk about how it’s being utilized in crypto.</p><h1 class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0" id="h-scaling">Scaling</h1><p>Blockchain transactions are validated by doing the computation, finding its right hash, and then posting it on the chain. Every transaction is sent to a validator who includes in the block(if the right gas is paid) and spends their computational resources in proving it right which takes block space and resources. As the chain usage goes up so does the value of block space aka gas &amp; txn costs.</p><p>Now one of the coolest things about zk is that we can prove the computational integrity of anything in a very small amount of data and resources.</p><h2 class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0" id="h-rollups">Rollups</h2><p>So an Idea is that for a batch of txns, the zk proof is calculated off-chain, and the zk proof generated is posted on the chain for verification and state changes. A zk proof is around 160 bytes while a txn is more than a few kilobytes literally reducing the data streaming on the chain by 10x and this same proof can prove a batch of txns let’s say 50 txn in 200 bytes of zk proof.</p><p>200 bytes➗ 50 = 4 bytes</p><p>While the eth Block size is 1 MB (15 million gas) and usually comes out to around 70 txns. so for each txn the size is around</p><p>1000 KB ➗ 70(no. of txns) = 14 Kilobytes</p><p>Data is money in the world of crypto and zk is much more efficient in proving the same thing but this comes with a tradeoff, as the proofs are generated off-chain there are always some risks and assumptions involved. One current example of a protocol using zk sna<a class="dont-break-out" href="https://zksync.io/" rel="noopener noreferrer nofollow ugc" target="_blank">rks is ZK sync</a></p><p>Now what I have talked about is mostly related to <strong>SNARKS</strong>(Succinct Non-interactive Argument of Knowledge) but there are different types of Zk proof with different security and risk profiles. This an Amazing blog post if you wanna lea<a class="dont-break-out" href="https://pseudotheos.mirror.xyz/_LAi4cCFz2gaC-3WgNmri1eTvckA32L7v31A8saJvqg" rel="noopener noreferrer nofollow ugc" target="_blank">rn about their dif</a>ference.</p><figure class="img-center"><img alt="" class="image-node embed" src="https://storage.googleapis.com/papyrus_images/d10157ed31ef478b528dd79a53fc0448d79e8f98a47ac1f5c132e411c6a2da95.jpg" /><figcaption class="hide-figcaption"></figcaption></figure><p><em>Credits - Consensys</em></p><p>Stark proofs are what runs the whole Starknet ecosystem. They are amazing advancements in tech as Starks don’t rely on the trusted-setup assumption and are mostly considered quantum-safe meaning they are safe from the emergence of quantum computers. The coolest thing about stark proofs is that their provability time rises much with the size of the proof.</p><h2 class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0" id="h-zk-evm">ZK-EVM</h2><p>ZK evm seems to be the most common words out these days so can’t miss that lol.</p><p>While rollups are off-chain solutions that generate zips (Zero-knowledge proof systems) off-chain, a zk evm is a zk-compatible Ethereum virtual machine that produces zk proofs for txns itself.As the original evm didn’t support zkp compatibility and after seeing the promise of this technology many projects have aped in!But there is a huge difference in different ZK EVMs as many target byte code composability while others work on more efficient proof generation. Vitalik write about their diff in an amazing blog post check <a class="dont-break-out" href="https://vitalik.ca/general/2022/08/04/zkevm.html" rel="noopener noreferrer nofollow ugc" target="_blank">it out there</a>A few Amazing projects that are building ZK evms are <a class="dont-break-out" href="https://ethresear.ch/t/unveiling-olavm-proof-of-concept-the-next-generation-full-featured-zkvm/14817" rel="noopener noreferrer nofollow ugc" target="_blank">OLA VM by Sin7</a> was really funny to dive into and can’t forget the work by one of the community favs 📜<a class="dont-break-out" href="https://hackmd.io/@yezhang/B167uMZRs" rel="noopener noreferrer nofollow ugc" target="_blank">Scroll</a> they are one of the best research teams in the space</p><h2 class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0" id="h-privacy">Privacy</h2><p>Privacy was one of the first goals with zkp systems, rn every single txn on ethereum is public while that might be good if you are hunting down a hacker or scammer general users might not want everyone to know their life savings if crypto has to go for better adoption.</p><p>One of the great implementations of this and vision was Tornado Cash which was sanctioned by OFAC and since then most of the liquidity that made it function has dried up 😭</p><p><a class="dont-break-out" href="https://aztec.network/" rel="noopener noreferrer nofollow ugc" target="_blank">Aztec Network</a> is Building on the privacy front of Ethereum like anyone can donate eth on Juicebox totally privately with the help of Aztec.</p><p>Solana Has its version of Zk.money where confidential transfers can be done with the he<a class="dont-break-out" href="https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs" rel="noopener noreferrer nofollow ugc" target="_blank">lp of this program</a> its an extension of the spl-token-2022 program. If you wanna learn more about how it works feel f<a class="dont-break-out" href="https://github.com/solana-labs/solana-program-library/tree/master/token/zk-token-protocol-paper" rel="noopener noreferrer nofollow ugc" target="_blank">ree to click here</a></p><p>Amazing work by one of the Scroll ZKevm researchers →</p><p><a class="dont-break-out" href="https://pseudotheos.mirror.xyz/" rel="noopener noreferrer nofollow ugc" target="_blank">https://pseudotheos.mirror.xyz/</a></p><p>Post on Zk privacy → <a class="dont-break-out" href="https://medium.com/cryptodigest/digital-identity-privacy-and-zero-knowledge-proofs-zk-snarks-3d092b509990" rel="noopener noreferrer nofollow ugc" target="_blank">https://medium.com/cryptodigest/digital-identity-privacy-and-zero-knowledge-proofs-zk-snarks-3d092b509990</a></p><p>And most of the ideas of rollups come from Vitaliks post Endgame → <a class="dont-break-out" href="https://vitalik.ca/general/2021/12/06/endgame.html" rel="noopener noreferrer nofollow ugc" target="_blank">https://vitalik.ca/general/2021/12/06/endgame.html</a></p><p><a class="dont-break-out" href="https://nakamoto.com/cambrian-explosion-of-crypto-proofs/" rel="noopener noreferrer nofollow ugc" target="_blank">https://nakamoto.com/cambrian-explosion-of-crypto-proofs/</a></p>