A public coin, zero-knowledge Folding Scheme for Committed Relaxed R1CS
The canonical Nova paper introduced a few things:
- An "augmented" R1CS structure, called Committed Relaxed R1CS
- A "folding scheme" for Committed Relaxed R1CS
- A way to turn the folding scheme for Committed Relaxed R1CS into an IVC
- A nova-specific zkSNARK, built on top of Spartan to compress and have zero-knowledge IVC proofs; i.e. prove that you know a valid IVC proof without divulging it.
The zero-knowledge Folding Scheme for Committed Relaxed R1CS is the main cryptographic engine that makes the Nova IVC possible and corresponds to points 1 and 2. It is laid out within the paper's section 4, of which this post is a condensed summary.
Motivation
The motivation for folding stems from a prover willing to convince a verifier that he knows two instance-witness tuples which satisfy a particular R1CS structure. This should be done without divulging those witnesses. We will review what this means below.
A trivial way for to check whether the two purpoted witnesses of are satisfying would be to check each of them. But this isn't satisfying, both from a computation and communication standpoint. Firstly, would need to send 2 witnesses and would have to check that the R1CS structure holds for both. Secondly, would send each of those witnesses, making this trivial solution non zero-knowledge.
A folding scheme for committed relaxed R1CS aims to patch this:
- It will turn the cost of the trivial solution consisting of checking each of those two witnesses into the cost of checking a single one, computed as a linear combination of the two.
- It will be zero-knowledge, keeping from knowing what are the two folded witnesses.
Naive R1CS folding
Combining instance-witness pairs linearly
In R1CS, we say that is a satisfying instance-witness pair when:
where compose the R1CS structure, is the witness and a vector of public inputs/outputs. The satisfying tuple has as its last element, a "dummy" variable representing constants. This writeup from Vitalik is a nice introduction to what R1CS is.
In the context of folding, will be in possession of two satisfying instance-witness pairs .
A simple cryptographic technique available to to avoid from cheating is to send him randomness. This will be of help for folding two R1CS instances. Indeed, will require from to perform a random linear combination of the two instance-witness pairs. It will look like this:
where is some random scalar parameter sent by . Now, ends up with a new, single instance-witness pair .
However, the newly folded does not satisfy the canonical R1CS equation of anymore! Indeed, naively plugging it into the R1CS equation yields:
Now, we end up with a cross-term and a quadratic term. This is not equal to the expected .
Also, note that when we take a random linear combination of our two instance-witness tuples we end up with:
An extra sneaked in our satisfying instance-witness tuple; the last element is not anymore!
Absorbing the cross-term and
First, let's introduce an error vector to account for the corresponding cross-term. Our new R1CS equation is:
You can see how will "absorb" the cross-term by plugging it in the above derivation for .
Now, let's re-write what we have so far without this cross-term to see what remains to be dealt with:
What's left is to absorb the remaining terms of and the extra element. To this end, let's introduce a new term, :
where .
Let's now see how and help us with folding.
Relaxed R1CS
A relaxed R1CS system will be basically R1CS, but equipped with the ability to take linear combinations of satisfying instance-witness pairs.
The relaxed R1CS equation is very similar to canonical R1CS. It says that given an error vector , an instance-witness tuple satisfies a relaxed R1CS equation when the following holds:
In this context, on top of folding two satisfying , , we will also need to combine two error vectors , together to compute a new folded vector :
As explained above, this folded will absorb the cross-term that pops up when naively plugging in a linear combination of the two instance-witness pairs in the original R1CS equation.
Let's try again taking a random linear combination of two satisfying relaxed R1CS witness-instance pairs. Let's define to be two satisfying instance-witness pairs and set . We get:
The pen-ultimate equality holds since has a term . This makes it possible to write the factorization .
You can now observe how the relaxed R1CS equation works, inserting and in and thus absorbing the cross and quadratic terms that pop up when taking random linear combinations of two satisfying instance-witness pairs.
Committed Relaxed R1CS
Assume knows two satisfying instance-witness pairs to a common particular relaxed R1CS structure. In the current state of things, checking that a relaxed R1CS holds requires to compute the term, which depends on and .
This means that will need both and to check that the folded instance-witness pair satisfies the equation . Thus, to make this scheme zero-knowledge, we will need to hide and .
We do this using a commitment scheme. On top of hiding, we will also need our commitment scheme to be additively homomorphic. Briefly, the property that an additively homomorphic commitment scheme verifies is if are commmitments to witnesses , then the equality holds. This will make able to check that the linear combination of has been performed correctly, but using committed witnesses.
Thus, a committed relaxed R1CS is a relaxed R1CS to which commits to using an additively homomorphic commitment scheme. A committed relaxed R1CS instance is satisfied if there exists a relaxed R1CS witness such that holds, where and - i.e. and have been correctly committed to.
A public-coin, zero-knowledge Folding Scheme for Committed Relaxed R1CS
We can now build a zero-knowledge protocol for folding committed relaxed R1CS witnesses. We describe it using the interactive version but we can make this non interactive using the fiat-shamir trick.
A prover wants to convince a verifier that he knows two relaxed R1CS witnesses and satisfying two committed relaxed R1CS instances and .
We want to do this in zero-knowledge. So, while both and know instances , only knows the two satisfying witnesses .
The protocol is the following:
- computes and sends to .
- The verifier samples a challenge and sends it to
- Both and compute the folded committed relaxed R1CS instance , with:
- sends the folded witness to :
can now do the following checks:
- , where
If all of those checks pass, accepts as a satisfying folding of two satisfying witnesses of instances
We see that had to check a single folded witness instead of two!
Side note: why Nova is not post-quantum
The additively homomorphic commitment scheme which Nova instantiates is pedersen commitments. But in a post-quantum context the hiding property breaks, as the hardness of the discrete logarithm fails. As of today, there is no existing quantum-resistant, additively homomorphic and succint commitment scheme. This is the sole piece missing to Nova being post-quantum ready.