A primer on zkSNARKs

If you have spent any time researching the world of Web 3 then you have no doubt come across the term zkSNARK. The term can be daunting for the casual researcher because search engine queries often present the complex math which makes zkSNARKs possible.

Having a basic grasp of the cryptographic technology is crucial to understanding rollups. Rollups have played a critical role in layer 2 blockchains which are helping solve the scalability trilemma [1].

By the end of this article, you should gain an understanding of:

  • What are zkSNARKs and how do they work?
  • How can we use zkSNARKs in the real world to solve problems of privacy?

What is a zkSNARK?

A zkSNARK is a cryptographic proof that allows one party to prove it posses certain information without revealing that information [2].

The term zkSNARK is an acronym that stands for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge.

Put simply, a zero-knowledge proof is a situation in which each of the two parties in a transaction can verify to each other that they have a particular set of information, while at the same time not revealing what that information is.

The important terms to understand from the acronym are:

  • Succinct zero-knowledge proofs can be verified within a few milliseconds, with a proof length which is only a few hundred bytes even if the statement is about a large program [3].
  • Non-Interactive zero-knowledge proofs consist of a single message sent from prover to verifier [3].

Structure and use cases of zkSNARKs

In an application of a zkSNARK, there is a prover and a verifier [4]. The prover wants to prove the truth of a statement without leaking any knowledge of the solution itself to the verifier.

The verifier wants to be reassured that the prover does have the solution or that the statement is true.

We can imagine use cases for zkSNARKs almost immediately- imagine frequent scenarios where one must reveal private information to verify something about one’s identity.

zkSNARK application in age verification

Let’s take a look at an example, how can Alice (our prover) prove her age to Bob (our verifier) without revealing her age [5]?

Alice is going to a bar and has to prove she is over the age of 18 to Bob before she can be served in the bar. She is reluctant to show Bob her identity card and instead Alice goes to a trusted source Trent.

Trent sends her a random seed and a proving statement to Alice. Alice now encrypts her age and gives both her encrypted age and the proving statement to Bob. Bob will now be able to verify if Alice is over a certain age without knowing what Alice’s age really is.

How are zkSNARKs even possible?

zkSNARKs are quite complex and difficult to understand so we will not go into too much detail in this article. They have been described as the “most powerful cryptographic technology” by Vitalik Buterin [6], the creator of Ethereum.

They leverage fascinating properties of polynomials, elliptic curve pairings, hashes and Merkle trees to enable a verifier to check millions of steps in a computation, without doing a piece of work to check each step individually.

A word of warning you will look to have a medium understanding of mathematics to read more into how zkSNARKs work. I recommend getting started with this article: An approximate introduction to how zkSNARKs are possible

Summary

To summarise:

Subscribe to Rayyan
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.