A basic introduction to zero-knowledge cryptography

A basic intro to the concepts that make zero-knowledge cryptography a powerful tool for providing privacy and trust on public blockchains.

zero-knowledge cryptography introduction

Zero-knowledge cryptography focuses on a fundamental concept: proving knowledge of a secret without revealing that secret itself. This allows one party, known as the prover, to convince another party, known as the verifier, that they possess certain information, such as a password or private key, without disclosing any details about that information. zkBob uses zero-knowledge cryptography to construct private transactions where amounts, recipients and senders are never publicly disclosed.

Basic concept of zero-knowledge cryptography

At its core, zero-knowledge cryptography is all about proving that you know a secret without revealing what that secret is. Think of it like a magic trick where you convince a friend that you know a secret password (like the combination to a vault) without ever actually telling them what the combo is. Your friend can ask a series of questions and you can provide answers (for example a list of all of the contents in the vault, or the order of contents, or words written on an envelope in the vault) without revealing any specifics about the combination. Your friend can be confident that you have the combo, but they'll never get any information about what the combo is.

The need for privacy and trust in zero-knowledge cryptography

In the online world, there are many situations where we need to prove our identity or knowledge of a secret without revealing the secret itself. A few common examples from the web2 world include:

  1. Password Authentication: Rather than providing a password, zero-knowledge proofs can help you prove your password knowledge without sending the actual password to the platform.
  2. Secure Transactions: When making an online purchase, zero-knowledge proofs can be used to show that you have a valid credit card without exposing your full card number.
  3. Protecting Personal Data: Imagine you want to access a service that requires your age verification, but you don't want to reveal your exact age. Zero-knowledge cryptography can allow you to prove you're a certain age without specifying the number.

How do zero-knowledge proofs work?

Zero-knowledge proofs rely on complex mathematical algorithms, however from a very high level the ideas can be broken down into 3 basic steps:

  1. Setup: In this phase, both the prover (the one who wants to prove their knowledge) and the verifier (the one who needs convincing) agree on a specific problem or statement that involves a secret. For example, the problem might be "I can prove these coins have not already been spent."
  2. Interaction: This is where the magic happens. The prover engages in a series of interactions with the verifier, where they provide evidence or responses that demonstrate their knowledge of the secret. These interactions are designed so that that the verifier becomes increasingly convinced of the prover's knowledge without actually learning the secret.
  3. Verification: After the interactions, the verifier can make a final decision about whether to trust the prover's claim. If the verifier is convinced, they accept the proof. If not, they reject it.

It's important to note that even if the verifier goes through multiple rounds of interactions, they will still have zero knowledge of the secret itself. They only know that the prover possesses the knowledge necessary to solve the problem.

Conclusion

Zero-knowledge cryptography is needed to enhance our digital security and privacy, especially in public forums such as blockchains. By allowing us to prove our knowledge of secrets without disclosing the secrets themselves, we are empowered to interact safely and securely in the digital world.

For much more detailed information on how zkBob handles these interactions using zkSNARKs and circuits, please see the zkBob documentation.