Why prove an answer without revealing it? Zero-knowledge in crypto

What is zero-knowledge? Follow a two-path cave to understand private proofs, crypto payments, and why a ZK-rollup does not automatically hide transactions.

20 phút đọcCơ bảnEyeBlogs

Đọc bản tiếng Việt →

Illustrated cave with two dark entrances, a large golden padlock in the center, and prominent ZERO KNOWLEDGE lettering above.
Mục lục

At school, proving that you can solve a problem usually means showing your working. But what if your working contains something you need to keep secret? A zero-knowledge proof lets someone check a claim without learning additional secret information used to establish it.[1]

Think of proving that you know a password without reading it aloud. What you need is not a promise that the other person will keep it confidential. You need a way to check your claim that never requires handing over the secret. In crypto, this idea can help verify a transaction even when some transaction data remains private.

We will start with a cave that has two paths. You do not need to know programming, blockchains, or cryptographic notation. Just remember one rule: the verifier must choose the challenge after the prover has made their choice.

Must you reveal a password to prove you know it?

Imagine a woman who sells meat at the market knows the password for a door inside a cave. You want to check her claim. She does not want you watching while she enters it, because tomorrow you could use the password yourself.

The simplest test would be to stand beside her, watch her enter the password, and see the door open. You get evidence, but the secret is gone. Sending a third person inside to watch and confirm does not solve the underlying problem either. It merely gives the secret to someone else.

A video of the door opening might seem more discreet. But was the door already open? Did someone help from inside? Was this one successful recording selected from many attempts? An apparently correct outcome does not necessarily test the claim you actually care about.

The meat-grinder story has the same difficulty. The seller takes a piece of meat behind a curtain and returns with minced meat. You have seen that she can supply minced meat. You have not established that she owns a grinder. Someone else might have helped, or she might have used a different tool.

We need a setting where a person who really has the secret can respond, while a person without it must rely on luck. The cave separates those cases without requiring the verifier to watch the door.

Two paths and one locked door

Picture a cave entrance where the passage splits into path A on the left and path B on the right. The paths loop around and meet farther inside. A password-protected door blocks the connection.

Without opening the door, someone entering A can only return through A. Someone entering B can only return through B. A person who can open the door can move between the two paths.

You wait outside and turn away while the seller enters. She chooses A or B, walks deeper inside, and waits. You cannot see which route she chose or hear her enter the password.

Only now do you flip a fair coin. Heads means you call for her to return through A; tails means B. She must emerge through the requested path. She cannot come out of the cave and walk around to the other branch.

Cave paths A and B connect through a locked door deep inside. The verifier stays outside. Steps: choose a hidden path, wait, flip a coin to select the exit, and return through that path.
Figure 1. The challenge is chosen after the seller enters. The locked door is the only way to switch branches without coming back outside.

If she knows the password, either request is manageable. If she is in A and you call A, she turns around. If she is in A and you call B, she opens the door and crosses to B. Starting in B gives the same two possibilities in reverse.

If she does not know the password, the connecting door is an obstacle. Having entered A, she can only hope you call A. If you call B, she cannot comply.

One successful exit might just be luck

You call A, and she comes out through A. Either she knows the password, or she chose A in the first place. A single observation cannot distinguish the two.

The coin gives two equally likely requests. Someone who cannot open the door can satisfy only one of them. That person therefore has a one-half chance of passing a single round.

Start again. She enters while you are not looking. Once she is inside, you flip a fresh coin. You do not reuse an earlier result or call out exits in a predictable pattern.

A person without the password has to get lucky again. Passing two consecutive rounds means half of a half: one quarter. Passing three means one eighth. Each additional round halves the remaining chance of cheating successfully.

Consecutive rounds that must all be passed Chance for someone who cannot open the door
1 1 in 2
2 1 in 4
5 1 in 32
10 1 in 1,024
20 1 in 1,048,576

These numbers follow directly from the rules; they are not survey data. Each challenge must remain random and unpredictable. If you always call A, a dishonest participant can simply always enter A.

That is also why the order matters. If you announce the required exit before she chooses a branch, she can enter that branch. She can then pass every round without knowing the password.

Avoid a common misreading: passing 20 rounds does not mean “there is a 99.9999% probability she is telling the truth.” We calculated the probability that someone unable to open the door nevertheless passes the entire test. Inferring the probability that she is truthful would require prior information and a different model.

If she fails, remember that this is an idealized model. In practice, someone might mishear a request or the door might jam. A real protocol must define exactly what counts as a valid response, rather than turn an operational failure into a judgment about a person.

What have you learned, and what remains secret?

After enough rounds, you have evidence that she can open the door. You have clearly learned something. “Zero-knowledge” does not mean leaving with an empty head.

You are allowed to learn that the claim being checked is true, alongside information already public at the outset. The checking process should not teach you more about the secret. For instance, if the password’s length is not public, the proof should not reveal it, the first character, or a hint that helps you guess it.

An age check offers a useful comparison. A shop might only need to know that a customer meets an age requirement. It does not necessarily need the customer’s full date of birth, address, and identity-document number. Proving “old enough” still reveals that condition, however.

The person supplying evidence is the prover, like the seller inside the cave. The person checking it is the verifier, like you outside. A protocol is the set of rules they follow, such as entering first and flipping the coin afterward.[1]

The terminology adds no mystery. It helps us distinguish who has the secret, who chooses the request, and which information travels between them.

Three standard requirements are that an honest participant can pass, a dishonest one cannot readily pass, and the checking process does not expose the secret. These are called completeness, soundness, and zero-knowledge, respectively.[1]

They are not interchangeable. A procedure might hide the password perfectly but let anyone pass. Another might check the claim thoroughly by requiring the password to be read aloud, yet fail to preserve secrecy.

Why is not seeing the password insufficient?

Suppose that instead of opening the door, the seller reveals one password character per round. You never see the whole password in any individual round. Collect enough rounds, though, and you can assemble the entire string.

Or suppose each answer eliminates half of the possible passwords. After enough questions, few candidates remain. Not transmitting the complete secret is different from not leaking information.

Zero-knowledge uses a stricter test: could what the verifier sees be simulated efficiently, using public information but not the secret? Simulation means producing a record with equivalent observable characteristics. Requiring efficiency rules out trying every possible password until one works and only then reconstructing the record.[2]

Imagine a video recording only your calls of A or B and the seller emerging through the requested path. A filmmaker who does not know the password could still produce such footage. For each attempt, randomly choose whether the seller enters A or B, then independently flip a fair coin to choose the requested exit. Keep only rounds where the request matches the entrance; otherwise discard the attempt and start again.

With a fair coin, it takes two attempts on average to obtain one usable round. Every retained round has a random request and a matching exit, just like your observations of someone who knows the password. No retained shot needs to show the door opening.

This does not provide a way to cheat in front of you. During a live test, you do not allow failed rounds to be silently deleted. Producing a plausible recording is different from answering a challenge as it happens.

This gives an intuition for proving that no secret information leaks. If an equivalent observable experience can be generated without possessing the secret, that experience carries no additional trace of it. An actual mathematical proof must consider the appropriate verifier model and everything the verifier receives. The filming story illustrates only a simplified version.

One consequence specific to this example is that a video does not convince a third party in the same way as personally flipping the coin. Do not generalize that all zero-knowledge proofs are non-transferable. Many blockchain systems are explicitly designed so that anyone can verify the same proof.

Three researchers changed the question about proof

School mathematics often asks whether a conclusion is correct, followed by a chain of reasoning establishing it. Cryptography adds another question: how much information must you expose to convince someone?

Shafi Goldwasser, Silvio Micali, and Charles Rackoff studied this question in The Knowledge Complexity of Interactive Proof Systems. The journal version, published in 1989, developed a framework for interactive proofs and the knowledge they communicate.[2]

“Interactive” simply means exchanging messages over several rounds, as when someone requests exit A or B and receives a response. The important change is not a formula to memorize. It is treating information disclosure as something that can be defined and checked, rather than trusting a designer’s assertion that the secret is well hidden.

A proof need not be a worked solution that teaches its reader how to solve the problem. It can establish a relationship without providing the private information behind it.

But a blockchain cannot invite each observer into a cave to flip a coin and wait. We need to move from two people exchanging requests to digital evidence that many computers can check.

Crypto faces the problem of checking money without opening a wallet

Here, crypto means cryptocurrency and blockchain systems, not advice to buy a coin. A blockchain can be pictured as a transaction ledger that many computers maintain and check against shared rules.

A public ledger enables independent inspection. But if anyone can read payment details, a stranger might observe more than you would like. An address without a real name does not guarantee that its activity cannot be connected to an identity.

Hiding everything creates a different problem. If you simply say, “I have enough money; record this transfer,” how can the network reject someone inventing money?

Consider an illustrative payment. You have an existing payment note worth 10 units. You want to send 6 to a seller, retain 3, and pay a fee of 1. The network needs to check that inputs equal outputs plus fees. It also needs to establish your authority to spend that note and that it has not already been spent.

If everything is public, checking that 10 equals 6 plus 3 plus 1 is easy. To keep individual amounts private, you need to prove that the hidden numbers still obey the correct arithmetic. Zero-knowledge can help with that task.[3][4]

Unlike the cave verifier, the computers do not watch someone emerge from a tunnel. They receive public data and a digital proof. Software checks whether the proof matches the published rules.

The sealed envelope of digital money

Think of a number written on paper and placed in a sealed envelope. You cannot read it, but the person who sealed it must not be able to replace its contents after everyone has recorded the envelope.

A cryptographic commitment plays a similar role. It provides a public representation of private data. Its construction must both conceal the contents and bind its creator to the selected contents, under the system’s security assumptions.[4]

Do not take the envelope literally as a digital box that anyone can eventually open. The analogy describes two properties: concealment and resistance to changing the committed contents. Private values and randomness produce the public representation according to mathematical rules.

The randomness is like giving two envelopes different seals even when they contain the same amount. If an amount were merely converted into a simple fixed code, an observer could try small amounts and look for a match. Protecting data with few possibilities requires more care than saying it has been hashed.

A hash function is like a machine producing a fingerprint of data. The same input produces the same result, but the result is not an encrypted message that a key opens. The article on RSA and digital signatures explains another cryptographic task: checking an authorization mark without receiving the secret signing key.

A zero-knowledge proof can connect commitments to the conditions being checked. For example: I know contents matching these public representations, and their values balance. The verifier need not receive those contents in the clear.

If a payment is hidden, how do you stop it being spent twice?

A paper ticket can be torn after use. Digital data is easy to copy. If the network cannot see which note is being spent, how can it recognize someone using that same note to pay two people?

In a shielded payment system such as Zcash, a nullifier can be pictured as a “used” marker for a private ticket. Spending a note reveals the marker. The network remembers previous markers and rejects a repeated one.[4]

Crucially, the marker must be derived according to rules tied to the note and relevant secret information. The spender cannot arbitrarily choose a different marker for a second attempt. Cryptographic checks enforce that relationship.

The design must also prevent an observer from readily linking the “used” marker to the particular note created earlier. If every public marker directly named its original envelope, the amount might remain hidden but the payment’s path would be exposed. Separating those traces is part of privacy engineering, not an automatic consequence of subtraction.

For our 10-unit example, several conditions must hold together. The input must belong to the recorded set of notes; the spender must be authorized; outputs plus the fee must balance; and the used marker must not repeat. Values must also lie in the allowed range, so a negative amount cannot be used to evade the arithmetic.

Real transactions divide the work among zero-knowledge proofs, signatures, commitments, and public checks. It is misleading to say that ZK handles everything. The article on tapping a payment button twice also concerns repetition, but it addresses processing a repeated request. Preventing double-spending concerns the right to use money.

How does Zcash hide transaction details?

Zcash is a real application of zero-knowledge proofs to shielded payments. With an appropriate shielded transaction, the network can verify validity without publishing private details as a fully transparent transaction would.[3]

But “a network supports privacy” is different from “all activity on that network is private.” You need to examine the transaction’s address types and mechanisms, any parts crossing a transparent boundary, and the information still published for the network to function.[4]

Recipients still need information allowing them to use their funds. A wallet holder may also deliberately share information with an authorized viewer. Keeping information from the public does not mean nobody can know anything.

Privacy also depends on factors outside the proof. A monitored device, a publicly shared address, or the timing and amounts of transparent entry and exit transactions may provide clues. Hiding an envelope’s contents does not remove the camera at the mailing counter.

When a product advertises ZK, begin with a specific question: what does it hide, from whom, and under what circumstances? That answer is more useful than a promise of complete anonymity.

Why does a ZK-rollup not necessarily hide transactions?

A ZK-rollup applies related technology to another task. Picture someone calculating a batch of invoices, then submitting evidence that lets a central desk check the result instead of repeating every calculation in the old way.

On Ethereum, a rollup processes transactions outside the main network and submits results and validity proofs to it. Necessary data is also published according to the rollup design so that others can reconstruct its state.[5]

State is a snapshot of the books: which accounts hold what and what else the system records at a given moment. The proof helps check whether the transition from the earlier snapshot to the later one followed the rules.

The benefit here is primarily verifying computation. Transaction data may remain public, like invoices left on the table even though the desk does not add up every line again. Not revealing every intermediate calculation is different from hiding identities and amounts.

Question Shielded payments A conventional ZK-rollup
Main goal considered here Check a payment while hiding private data Check results from many transactions more efficiently
Useful follow-up Which data is concealed, and from whom? Which data remains public so the books can be reconstructed?
Does it automatically hide all transactions? No; it depends on the transaction type No

A rollup can add privacy features. But that cannot be inferred from the letters ZK alone. Correctness, privacy, and speed are three different questions, even when one system combines them.

Beyond proofs, consider access to data, depositing and withdrawing assets, and the authority to change software. Evidence that the invoices add up does not guarantee the shop will keep its collection counter open.

One submitted proof instead of repeated questions

The cave requires repeated exchanges. On a blockchain, a proof can be generated once and sent to computers for verification. Its creator need not answer each machine separately. This is called non-interactive, like sending a verifiable certificate instead of arranging a separate live inspection for every recipient.[3]

Non-interactive does not mean abandoning challenges and trusting the sender. Mathematical structure and explicitly stated assumptions bind the proof to its claim. Moving from question-and-answer exchanges to a single submitted proof is part of the difficult machinery that the cave does not explain.

You may encounter zk-SNARK: a family of succinct, non-interactive arguments concerning knowledge of secret data satisfying conditions. A useful image is a small checking slip representing a large computation. But that slip does not automatically contain all the data needed to operate the whole system.[3]

You may also encounter zk-STARK, a different approach emphasizing scalability and transparency in setup. You do not need to memorize the expanded acronyms. You should know they are not interchangeable labels for one product.[1]

Some systems require a trusted setup. Think of preparing checking equipment while ensuring nobody retains secret material that could be used to forge a passing result. Keeping that material contrary to the rules can undermine the security guarantees.

It is not correct, however, to claim that every SNARK requires a trusted setup. Zcash’s documentation describes how Halo 2, used for Orchard, removes that requirement. Read the specific construction rather than inferring everything from its acronym.[3]

A short proof is not free to produce either. The prover still spends computation and memory. A design may shift substantial work to proof generation to make verification lighter. Comparisons should identify whether they measure generation time, verification time, or total published data.

The small calculation behind twenty rounds

If you retain just one formula, keep the cave’s. Let nn be the number of rounds. For someone unable to open the door, the probability of passing all of them is:

P=(12)n.P = \left(\frac{1}{2}\right)^n.

The exponent means multiplying one half by itself repeatedly. Five rounds mean five factors. Twenty rounds produce a denominator of 1,048,576. You need not calculate that denominator mentally to understand the mechanism: each independent challenge halves the remaining chance.

The probability of passing every round without knowing the password falls from 50 percent after one round to about 0.000095 percent after twenty. The vertical axis is logarithmic.
Figure 2. Direct calculations, not measurements of a crypto system. Equal vertical intervals represent tenfold changes in probability, not equal percentage-point differences.

This curve is not Zcash’s or a rollup’s security guarantee. Those systems do not borrow the story’s number 20 and call the problem solved. They choose parameters and establish security for their own constructions.

If a cheater can restart indefinitely and display only a successful attempt, the eventual probability changes too. This is the digital version of the filmmaker discarding every failure. Whether attempts count is part of the problem’s rules.

Plot the chance of getting lucky

You do not need to run code to follow the article. This Python snippet simply draws Figure 2 from the formula above. It generates no cryptographic proof, connects to no wallet, and needs no market data.

It uses matplotlib and creates the article’s image directory when run from the EyeBlogs folder. There is no random sampling, so every run produces the same result. The printed lines provide checks for 10 and 20 rounds.

cave-probability.py
from pathlib import Path
import matplotlib.pyplot as plt
out = Path("images/zero-knowledge")
out.mkdir(parents=True, exist_ok=True)
n = list(range(1, 21))
p = [100 * 0.5 ** k for k in n] # probability as a percentage
fig, ax = plt.subplots(figsize=(9, 5), facecolor="#fcfcfb")
ax.set_facecolor("#fcfcfb")
ax.plot(n, p, color="#2a78d6", linewidth=2, marker="o", markersize=8)
ax.set_yscale("log")
ax.set_xticks([1, 5, 10, 15, 20])
ax.set_yticks([10, 1, 0.1, 0.01, 0.001, 0.0001])
ax.set_yticklabels(["10%", "1%", "0.1%", "0.01%", "0.001%", "0.0001%"])
ax.set_xlabel("Consecutive rounds that must all be passed")
ax.set_ylabel("Chance of passing all rounds without the password")
ax.set_title("Each new round halves the chance of getting lucky", pad=16)
ax.grid(axis="y", color="#dededb", linewidth=0.6)
ax.spines[["top", "right"]].set_visible(False)
ax.tick_params(colors="#52514e")
fig.tight_layout()
fig.savefig(out / "xac-suat-en.png", dpi=180)
plt.close(fig)
for k in [10, 20]:
print(f"{k} rounds: 1/{2**k} = {100 * 0.5**k:.9f}%")

The result is 1 in 1,024 after 10 rounds and 1 in 1,048,576 after 20. Read the chart labels carefully: the vertical scale does not use equal additive increments. This scale keeps the tiny probabilities at the end visible instead of flattening them against the bottom.

You can replace 20 with 30 and watch the probability continue falling. But changing the formula does not turn this model into usable cryptography. A real system must also resist fabricated data, advantageous challenge selection, proofs reused in the wrong context, and implementation errors.

Where do Bitcoin, ETH, and ZK fit in the crypto market?

From an investment perspective, distinguish technology, networks, and traded assets. A useful verification method does not make every coin carrying its name valuable. Transport needs roads, but holding a card with a highway printed on it does not entitle you to collect tolls.

Bitcoin names the network; BTC is its asset’s ticker. A frequently discussed characteristic is the issuance limit of approximately 21 million BTC under the current rules. Limited supply does not guarantee a rising price, however. Price also depends on how many people want to hold it and what they are willing to pay.[6]

BTC is not company stock and gives no claim to corporate profits. Evaluating it involves questions about use, demand to hold it, network security, and trading conditions. Liquidity means being able to buy or sell without moving the price excessively, like a currency-exchange counter with enough business in both directions. A supply cap answers only part of the value question.

Bitcoin also does not automatically conceal transactions because it uses cryptography. Its transaction ledger remains public. Not directly recording real names is different from making activity untraceable. Bitcoin should not be confused with the shielded-payment model discussed for Zcash.[6]

Ethereum is a network for running shared programs, such as rules transferring assets when conditions are met. Ether, with ticker ETH, pays for network use and participates in securing the network through a mechanism that locks assets, called staking. Think of usage fees as fuel for performing work. Staking is more like posting collateral to take on verification responsibilities than a guaranteed savings deposit.[7]

ZK-rollups can connect to Ethereum through demand for proof verification and data publication on the main network. But jumping from that to “ZK adoption means ETH must rise” skips an economic argument. Actual demand, work submitted to the main network, and fees per unit of work all matter. Lower cost per transaction can coincide with greater use; the total effect cannot be inferred from either side alone.[5]

Ethereum removes a base-fee component from circulation under its rules, commonly called burning fees. This connects network use to ETH supply, but does not reduce ETH’s price to a simple multiple of transaction count. New issuance, demand to hold the asset, and market expectations remain separate considerations.[8]

For a token, a unit of an asset issued by a system, ask what rights its holder actually receives. Is a ZK project’s token required to pay fees, used only for voting, or governed by some other mechanism? Where do users’ fees go? Widely used technology does not necessarily channel economic benefits to a token in the way buyers imagine.

This is a way to examine the crypto market through mechanisms rather than promotional labels. Bitcoin, ETH, and ZK-project tokens are not three versions of the same product. Understanding zero-knowledge helps evaluate a technological promise. Valuing an asset needs a separate argument.

Back to the person outside the cave

You have remained outside throughout. The locked door is still out of sight. After many unpredictable requests, you have evidence that the person inside can open it, but no password you can use tomorrow.

In crypto, the door becomes conditions about spending authority and correct arithmetic. Some systems use proofs to keep payment information private. Others use them to verify computations more efficiently while the data remains public. The same broad idea can support different promises, each of which needs its own scope.

Zero-knowledge changes a familiar assumption: checking something does not always require collecting all the data. Sometimes a trustworthy answer to the right question is enough, without demanding the secret behind it.

Free geometry illustrations for students and teachers: EyeViz.

Tài liệu tham khảo

  1. [1]Zero-knowledge proofs. Ethereum.org.
  2. [2]Shafi Goldwasser, Silvio Micali and Charles Rackoff. The Knowledge Complexity of Interactive Proof Systems. SIAM Journal on Computing, 1989.
  3. [3]What are zk-SNARKs?. Zcash.
  4. [4]Zcash Protocol Specification. Zcash.
  5. [5]Zero-knowledge rollups. Ethereum.org.
  6. [6]Frequently Asked Questions. Bitcoin.org.
  7. [7]What is Ether (ETH)?. Ethereum.org.
  8. [8]Gas and fees. Ethereum.org.