What are zk-SNARKs?

icon DATA
Photo - What are zk-SNARKs?
zk-SNARK is the most well-known type of zero-knowledge proofs (ZKP). This technology allows a user to affirm data ownership without disclosing the actual data to someone else. This is akin to the “Spy” game, where players demonstrate their knowledge of a word without actually saying it.
The foundational academic paper introducing zk-SNARK was released in 2013, and co-authored by Alessandro Chiesa, a founder of Zcash and StarkWare Industries. Zcash emerged as the first practical use of zk-SNARK in private transaction technologies.

What is zk-SNARK?

After the advent of Zcash, various adaptations of zk-SNARK have emerged, but the foundational technology remains unchanged. The term zk-SNARK abbreviates to Zero-Knowledge Succinct Non-Interactive Argument of Knowledge, each element of which we'll examine in detail.

Zero-knowledge. This aspect ensures that no information is disclosed beyond the verification of its legitimacy. The verifier assesses the truthfulness of the information without accessing its details.

Imagine a scenario with a person holding red and green balls and another wearing special glasses that only show shades of color, not the colors themselves. The holder aims to convince the observer that the balls are different colors without revealing which is red or green.

When the observer dons the glasses, the holder shuffles the balls. If the observer can discern a difference in the shades, it indicates the balls are of different colors. If not, they are the same. In this analogy, the glasses represent the function of zk-SNARK.

In the cryptographic world, succinctness relates to the compactness of the proof and its swift verification. Regardless of how complex or voluminous the original data is, its proof remains neatly condensed.

Consider the task of understanding a 50-page book. Rather than reading the entire text, you consult a summary provided by an intermediary (akin to zk-SNARK). Although this summary (the proof) is briefer than the full book (the data), it still conveys the key essence.

Non-interactive. Traditional systems might require several interactions to achieve consensus. zk-SNARK's non-interactive nature means the prover generates a single proof and sends it to the other party, eliminating the need for ongoing dialogues.

Arguments of Knowledge. This concept emphasizes that the prover knows not just the result of an operation but also its intricate details. With zk-SNARK, you can demonstrate more than the mere fact that “the sum of two numbers is 10”; you show an understanding of the specific numbers involved.

Key applications of zk-SNARKs

At the EDCON2023 conference in May this year, Ethereum founder Vitalik Buterin discussed the primary challenges facing the blockchain industry. He identified four key areas of concern:

  • Privacy,
  • Scalability,
  • User account security,
  • Smart contract security.

Vitalik highlighted the crucial role of zk-SNARK in tackling these challenges and its potential impact on shaping the Web3 ecosystem over the next decade. To grasp the diverse applications of zk-SNARK, let’s delve into how it addresses the three most pertinent issues.

Enhancing Scalability

One approach to scaling blockchain is through Rollups, which bundle several transactions together and process them outside the main network. zk-Rollups, which incorporate Zero-Knowledge Proofs, enhance blockchain efficiency.
The working principle of zk-Rollups. Source: messari.io

The working principle of zk-Rollups. Source: messari.io

zk-SNARKs differ from traditional proof systems by functioning as aggregators. They compile a unified proof for a group of transactions, processing this collective proof rather than individual transactions.

The brevity of zk-SNARKs enables quick and effective validation of all transactions in the group. Additionally, the non-interactive nature of this technology reduces network strain, leading to increased blockchain capacity and lower transaction fees.

Projects like zkSync and Polygon Hermez are at the forefront, utilizing zk-SNARKs to scale Ethereum.

Facilitating Private Transactions

zk-SNARKs play a pivotal role in securing transaction privacy within the blockchain. They enable the concealment of key transaction details such as the sender and receiver's addresses and the transaction amount, while still allowing these transactions to be validated.

Private transactions on the blockchain offer a shield against financial surveillance, censorship, and front running (manipulative tactics involving preemptive transaction placement). However, this level of privacy also presents risks, potentially facilitating unlawful activities.

Prominent projects like Zcash and Tornado Cash leverage zk-SNARKs to achieve these private transactions.

Securing Identity Verification

Frequent identity verification, necessary for banking, travel, and various other activities, increases the risk of personal data breaches.

zk-SNARKs enable users to affirm their identity without disclosing sensitive details like passport numbers or addresses. This approach streamlines authentication processes; institutions such as banks retain only the proof of identity rather than the full suite of personal data.

Zk-creds, a protocol for account verification, integrates zk-SNARKs to bolster privacy and security in identity authentication.

How zk-SNARK Work

zk-SNARK operates on a framework of cryptographic functions, encompassing key generation, proof creation, and verification processes. To fully grasp their interplay, let’s explore each function in greater detail.

Key Generation Function 

At the heart of zk-SNARK’s setup is the key generation function. This stage involves crafting cryptographic keys essential for the system’s functioning. There are two key types: the proving key (used for crafting proofs) and the verification key (used for validating these proofs).

Imagine a system where C(x,w) is a statement to be verified, yet its details remain undisclosed. Here, x symbolizes public data, while w represents private data. The setup function mathematically embodies this statement, accepting a security parameter λ. This function is instrumental in generating both the proving key pk and the verification key vk.

Setup (C,λ)  → (pk,vk)

Proof Generation Function

This function is initiated by the prover to create a cryptographic affirmation, denoted as prf. This proof, comprising private data w (the witness), public data x, and the proving key pk, is then forwarded to the verifier.

Prove (w,x,pk)  → prf

Verification Function

The verifier’s role involves employing this function to assess the proof received from the prover. It processes the proof prf, the verification key vk, and the public data x.

Verify (prf,vk,x) → True (if the proof is valid) or False (if the proof is invalid)
Operational Schema of zk-SNARK. Source: medium.com

Operational Schema of zk-SNARK. Source: medium.com

This methodology proves efficient as it upholds the three foundational ZKP principles:

  1. Completeness: If the statement C(x,w) is accurate, then the proof prf will invariably be authenticated.
  2. Soundness: Should the statement C(x,w) be incorrect, any proof prf generated by the prover will be deemed invalid by the verifier.
  3. Zero-Knowledge: The verifier assesses the proof prf without needing to access the private data w.

Note that both the “prover” and “verifier” are algorithmic roles.

Beyond this foundational principle, zk-SNARK is anchored by three key concepts: elliptic curve cryptography, the trusted setup, and the Fiat-Shamir heuristic.

Elliptic Curve Cryptography:
zk-SNARK’s security is bolstered by elliptic curve cryptography (ECC), a method involving public and private keys for encrypting data, akin to Bitcoin's mechanism.

Trusted Setup: This setup phase is crucial for generating the proving and verification keys. A special form of data, known as “toxic waste,” is produced during this phase. Should this data be compromised, it could lead to the creation of fraudulent proofs. Multi-party computation offers a resolution to this issue.

The multi-party computation approach distributes responsibilities among several participants, thereby fragmenting the “toxic waste.” Each participant holds a piece. If even one participant disposes of their portion, falsifying proofs becomes unfeasible.

Fiat-Shamir Heuristic: This heuristic transforms interactive proof systems into a non-interactive format, setting zk-SNARK apart from other ZKP types.

In traditional interactive systems, the verifier sends numerous random queries to the prover until the proof’s validity is established. The Fiat-Shamir heuristic streamlines this process by enabling the prover to generate a singular, comprehensive proof for submission to the verifier.

Final Words

zk-SNARK, like many cutting-edge technologies, has potential misuse scenarios, impacting even legitimate market participants. A notable instance was in 2022, when the U.S. Treasury imposed sanctions on Tornado Cash, a crypto mixer, affecting interactions with Zcash across various decentralized applications (dApps).

Despite these challenges, industry leaders like Vitalik Buterin and venture capital firm a16z regard zk-SNARK as a significant trend in the 2024 crypto market. a16z, in particular, has predicted its emergence as a mainstream technology.

Vlad Vovk
Writes about DeFi and cryptocurrencies from a technological perspective.