Understanding Zero-knowledge proofs through illustrated examples
blog.goodaudience.com
blog.goodaudience.com
Anyway, he was a great professor. When talking through algorithms, he'd always start with say, an n^4 solution. Then cut it down to n^3, call on people to help out, etc. I remember it being something like this (in an Italian accent that we really enjoyed)
"And now we're at n^2! Pretty good you might think eh? After all, we were at n^4 just a few minutes ago, this is much better? But, the human mind is a wonderful thing! It is so creative and some people thought about it, and they got n log n! Amazing. I know you are thinking, n log n is always as good as it gets in this class. Well I don't want to go into the details because, it is horrifying! But actually some people, they did even better! And you know as I said, the human mind is amazing! So maybe one day, you will do even better."
Also I sat across the aisle from him when Eliezer Yudkowsky came for a talk and only realized it when he answered a question EY asked the audience.
This kind of turned into me reminiscing but my point is, the guy who put these out there and did a lot of work on them is a great undergrad professor and that makes me happy.
I honestly can't remember much about the class except that it was really difficult and I haven't really used anything I learned from that class in my day to day. Hopefully there's something stored in my brain somewhere if I ever need to recall his lectures in the future.
> We note that the constants 2/3 and 1/3 are arbitrarily chosen for simplicity. We can always amplify the completeness probability to 1 − negl(λ) and the soundness probability to negl(λ) with repetition.
But that's not completeness in the metamathematical sense. That's a statistical boundary on what it takes to "convince" someone (or "gain knowledge"). But that's a stochastic redefinition of a pretty hard-line property of proof systems. In other words, you could theoretically have no knowledge and just get astronomically lucky to an arbitrary degree (whatever degree it would take to cross that proof threshold).
Even if you remove all the statistical nature from the system: They're trying to prove they have a piece of knowledge of finite size. If astronomical luck is a real concern, then you have to worry that even a non-probabilistic prover could have just guessed the knowledge.
Or as an analogy, even if you had a perfect and magically irreversible hash, someone could still guess the password first try.
Scott Aaronson (of quantum computing and P=NP blogging fame) likes to joke that, “okay, fine fine, so these statistical proofs are good enough for the launch codes, military encryption, and multi-billion dollar financial transactions… but what about theorem proving, where you just can’t take any chances?”
You instead have Bob randomly choose whether Alice must a) pull off the screen, revealing the original page, or b) punch a hole through to Waldo, but not both. Then you can do any number of rounds of this, with Alice putting the page in a random position each time.
It's only convincing to Bob because bystanders (or rather, anyone not part of the random number generation for which challenge to use) can't rule out the possibility that they conspired to have Bob always pick the challenge that a faker Alice could solve. (Show the original page when the uses the real one, punch a hole when she uses a fake page.)
[1] https://news.ycombinator.com/item?id=15323790
Edit: That original comment gives the "magic formula" for coming up with such ZKPs as well.
And I assume the screen is meant to always cover the picture (i.e. MUST be much larger than the picture) and only Alice can know the actual coordinates of the picture behind the larger screen (otherwise Bob can infer the position of the Waldo), right? It is also possible that I have not understood something from your interesting proof there.
Thanks for sharing the discussion about the finer points of ZKP being only between Alice and Bob.
And my model has it so that (for the second challenge) Bob learns the position of Waldo relative to the screen, but not the position of Waldo relative to the page, which is what we mean by "finding Waldo". And, of course, on that challenge, Bob would not get to learn the position of the page relative to the screen (which would allow him to "find Waldo").
As an example: given a chess position, would you be able to construct a zero-knowledge proof that you can force checkmate in N moves or less without revealing anything about the particular moves involved?
If so, what would such a proof look like?
So no, not all provable statements are zero-knowledge provable if by zero-knowledge proof you mean an interactive proof where no information is transferred.
Of course it's possible that in the future, other types of zero knowledge proofs will be formulated that are not interactive proofs. For example there are zk-SNARKs that are non-interactive and zero knowledge, but they form a subset of IP and in fact are a subset of NP problems.
IP is _known_ to be _equal_ to PSPACE
Thanks for your correction.
https://en.wikipedia.org/wiki/PCP_theorem
This is where zkSNARKS help since they generate a non-interactive + succinct proof.
To the best that anyone knows, for a generalized chess board of size WxW, to demonstrate that a checkmate can be forced in at most N moves, you'd need a candidate set of almost every possible sequence of N moves. You can prune some sequences, but not enough to bring the size of the candidate set down to something that can be verified in polynomial time.
Chess, depending on how you generalize it, belongs to EXPTIME.
"Prove it!" - Me
"aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f" - God
In the case where you prove existence, it's easy as just knowing the object is a proof. Here it's not really a proof of existence, it's more complex.
The only proof acceptable here would be the whole tree starting from this point. This seems too complex to use in a zero knowledge proof
On first learning of them, I had the common reaction of "I can't believe this is even possible to do".
The way that I came to intuitively understand them is by analogy to public key cryptography. Digital signatures allow someone to run the RSA algorithm on some piece of private data X and prove the output is Y, without revealing X.
zksnarks are a generalization of this idea. They allow one to prove that they ran any arbitrary program P (in np) with some private data X, and it produced output Y, without revealing X.
It seems (slightly) less mystical for me to see it that way.
e.g. to prove that some blockchain nodes ran a set of data through a particular infra setup (e.g. a bunch of language arbitrary Lambdas, SQS queues etc. defined in cloudformation or terraform).
Maybe you meant you needed to show proof that only you (not somebody else) knows some data?
Even for such scenario I would not be sure it’s correct. Many signature implementations hash the data, then sign the hash; if I happen to know the hash but not the data, I could just sign it without owning it.
(I should verify a few things, this was written off the top of my head).
Because in order to verify that a hash over some secret data is correct you need access to the secret data, which makes it pointless.
Only using a signature can the signer prove that they have knowledge of a secret number (their private key) by providing information that does not reveal the secret (public key, message hash, signature).
No. You could have access to the hash.
For the private/public key signing, of course; the signature guarantees that you have access to the private key. But if the ‘private secret data’ is not the private key?
It is in the example you were replying to. That’s my point.
With zk-snarks, I can, theoretically, run some complex analysis of some data -- imagine something that requires millions of compute hours -- and provide a receiver (a) the answer, and (b) a compact hash-like proof that (a) is correct *without* receiver having to re-run the calculation to trust the answer.
On the sudoku example, I built out a playable version of zero-knowledge sudoku a few months ago: https://github.com/nalinbhardwaj/snarky-sudoku
It doesn't use the same strategy as the article, but the underlying idea of non-interactive SNARK based proof is the same (just using the more general circom circuit library to compile the constraints into a ZK-SNARK).
Of course, it could be that someone does it one day, and if so modern cryptography is useless, but I highly doubt it.
1) Some experiments/learnings https://github.com/JofArnold/zkp-learning-in-public
2) A blockchain-based Dungeon crawler built for a hackathon that uses a SNARK (Circom, snarkjs) to validate that the user hasn't cheated when getting to the end of the maze https://github.com/Derked/FantasyCampaign
We briefly considered making this a completely open-source, decentralized thing completely controlled by the community. Your comment has definitely made us a bit more motivated to do that!
I'm completely onboard with the Axie thing. It's an interesting start but I think these kinds of play-to-earn models are fairly toxic.
Have to say, after reading several tutorials on different languages that allow you to build zk proof circuits, it still seems very difficult to encode the problem a priori into them such that the result is useful. For example, using them in cryptocurrency seems tricky because you often have to encode the actors involved (by way of their addresses) in advance when you put the zkSNARK on the chain, which makes that less useful.
I really enjoyed Cairo tutorials which have similar concepts.
Authenticating your identity: rather than giving your mother’s maiden name over the phone to a random, bank call center agent, you can simply send a proof (a cryptographic fingerprint), that you are who you say you are.
These examples tipped me off. Can someone help me understand how it is safe. Say one can send the exact cryptographic fingerprint and impersonate me. How is this anything better than me just sending password to authenticate?
If you're genuinely interested in this topic, you will, I think, really enjoy what I'm about to tell you.
You can setup a system where: 1- you never tell the server your plaintext password at any time, ever; 2- the server does not know your actual password and cannot determine it; 3- you can prove to the server that you know the password, and they have strong proof that you do know it; 4- nobody that eavesdrops on you can do likewise.
Cryptography is magic. And it mostly has to do with the authentication protocol being multi-step. IE: you don't just send your password or fingerprint, you send X and the server sends back Y, and you send Z, and so on and so on, but after a few steps, you have proven yourself. And since it's all being done on GHZ speed computers and gbps networks, it's fast enough for human use.
There are better algorithms than this one, evolutions on the idea, but the most common one discussed is Secure Remote Password Protocol: https://en.wikipedia.org/wiki/Secure_Remote_Password_protoco...
And honestly, I'm not even doing justice to how cool these protocols are. It's an incredible topic.
The message can be signed with a private key to ensure you are not being impersonated. In cases where you'd also like anonymity, it is possible to add some salt as an input to the 'cryptographic fingerprint,' obfuscating the unsalted proof.
This video is good material for learning to reason about ZK proofs: https://www.youtube.com/watch?v=J3UlqJk3Kl0
My bank doesn't even support OTP 2FA for login. There's no way they'll support this stuff.
If I remember correctly the article said that it is possible for any given mathematical theorem and proof it is possible to produce a graph such that (1) the proof is correct if and only if the graph has a Hamiltonian circuit, and (2) you can show people the graph and prove to them that it is such a graph for that theorem.
The article then gave a ZKP scheme for showing that you know a Hamiltonian circuit on a given graph.
Putting it all together then someone who claimed to have a proof of the Riemann Hypothesis or Goldbach's Conjecture or any other famous unsolved mathematical problem could produce the corresponding graph, and produce a ZKP that they know a Hamiltonian circuit for that graph, and we'd have to accept that they have in fact solved the problem.
I wonder what would happen if someone actually did that for one of the Millennium Prize Problems [1] or some other high profile problem that has a substantial reward behind it? When offering prizes for proofs nowadays should you include a clause in the rules that states to win the prize you have to publish a conventional proof?
The output of any StarkNet program can be transformed into an extremely succinct zero-knowledge proof. This proof generation process is quite costly. But then, the proof itself is extremely tiny and may be verified extremely inexpensively.
Coincidentally with this post, StarkNet launched this week after seven years of R&D.
> This proof generation process is quite costly.
Where can I find some benchmarks for creating various proofs?
This technology can be groundbreaking or useless solely depending on how long it takes to create a given proof.
- a recent tweet by StarkWare President Eli on some performance stats https://twitter.com/EliBenSasson/status/1467161132569931784
- StarkWare discord server https://t.co/klHVDhQokP
- StarkWare research forum https://community.starknet.io/
Say I'm a middle man escrow service with an untrusted channel, and trusted A has sold a secret X to untrusted B using me, and B now wants to sell X to untrusted C on my platform. Is there a ZKP way to both make sure B doesn't scam C by sending a fake secret, and C doesn't scam B by saying they received a fake secret? Obviously while me and snoopers never knowing what X is?
The general public isn't involved in constructing the proofs, just as they don't manually engage in cryptographic exchanges of any kind. Absent cryptographic expertise, the general public is forced to delegate their trust to cryptographic experts, whose code they execute when making exchanges with tricksters.
Like I go to website A and they want me to authenticate that I have access to a unique email address without revealing which one and they offer a zkp-email-ident challenge, I’d have to use OpenZKP which supports zkp-email-ident because the cryptography community vetted it and thus it’s included as a supported auth challenge? So the implication here would be that the protocol specifies the exact nature of the (back to the cutout example) image such that it’s impossible for Bob to apply an adversarial watermark?
So generally ZKPs are more like a cryptography primitive and protocols must be developed that apply them in ways that mitigate adversaries.
Non-interactivity to me would be if the verifier just got a blob of data and was able to do whatever they wanted with that.
The key idea is that these numbers somehow don’t reveal which digit goes where.
> Starting with each row, Bob randomly chooses one card in each cell, from the top, the middle, or the bottom
The random assignment of solutions from each pile to each of the three problems means that the only way to consistently pass the test is to have the three solutions in each pile be identical.
Doesn't detract from the main ideas and shouldn't be too hard to fix.
Logic "works" not because its rules are absolute, but because Universe has its structure and laws. Ignoring validity and non-contradiction of premises renders any conclusions meaningless (merely abstract Hegelian bullshit).
Causes (and premises) are not arbitrary so the assumption that everything can be deduced (proved) from anything is bullshit.
Applied math require a type discipline and abstract math is just a set of rules, like abstract logic. And this is my contribution to science.