originates from the question, "How can we generate proofs for R1CS as quickly as possible?" It presents a scheme that achieves proof generation with O(N) field operations. To accomplish this, it introduces a method of encoding that operates in linear time. While similar techniques were used in, Brakedown distinguishes itself by being more practical. Additionally, it does not require a trusted setup, may offer quantum resistance, and is field-agnostic, making it more practical.
Background
See for more details.
Why use Merkle Tree operations?
When committing to an O(N)-length vector, the operations involved generally have the following complexities:
FFTOperations → O(N⋅logN) field operations
Merkle TreeOperations → O(N) hash operations
MSMOperations → Using Pippenger's algorithm, O(N⋅λ/log(N⋅λ)) group operations
To achieve O(N), FFT operations, which are O(N⋅logN), cannot be used. Similarly, MSM operations are avoided because group operations are slower than field operations. Instead, Merkle Tree operations are utilized for commitment.
The traditional encoding function used in RS-codes involves FFT operations. However, due to the limitations mentioned earlier, alternative encoding methods must be explored.
Tensor Product
The is an operation that generates all possible combinations of two vectors v and u from different vector spaces. For example, if q1=[a,b] and q2=[x,y,z], the tensor product between the two is the following matrix:
q1⊗q2=[a⋅xb⋅xa⋅yb⋅ya⋅zb⋅z]
Additionally, the tensor product can be used to express a Multi Linear Extension (MLE) evaluation like so:
Given an evaluation point r∈Fl and z∈F2lg(r)=⟨⊗i=1l(r1,1−r1),z⟩=⟨(r1,1−r1)⊗⋯⊗(rl,1−rl),z⟩
For example, when l=2, the MLE evaluation is calculated as follows:
The protocol is divided into three phases: Commitment Phase, Testing Phase and Evaluation Phase.
Commitment Phase
This phase commits to the input matrix, with the following steps:
Each matrix u is provided as an input, where ui represents the i-th row.
u={ui}i∈[r]∈(Fc)r
For a given rate ρ, each row of length c is encoded into a row of length N, producing an r×N matrix u^. The prover commits this u^ matrix to the verifier using Merkle hash.
u^={Enc(ui)}i∈[r]∈(FN)r
Testing Phase
This phase verifies whether the encoding was performed correctly, with the following steps:
The verifier samples a random scalar α and sends it to the prover.
The prover computes u′ using the random value α and sends it to the verifier:
u′=RLC(u)=i=1∑rαi−1⋅ui∈Fc
The verifier tests the following equality by sampling l values between 1 and N:
i=1∑rαi−1⋅u^i=?Enc(u′)
This holds because encoding and random linear combination (RLC) are commutative and the codeword is linear code. That is, encoding the rows of the matrix and then performing RLC is equivalent to performing RLC first and then encoding. According to Section 4, "Concrete Optimizations to the Commitment Scheme," the testing phase can be skipped if a Polynomial Commitment Scheme is used.
Evaluation Phase
This phase performs identical checks as in the testing phase but without encoding, with the following steps:
The verifier samples q1∈Fr.
The prover computes u′′ and sends it to the verifier: (Identical to Testing Phase 2.)
u′′=i=1∑rq1,i⋅ui∈Fc
The verifier tests the following equality by sampling q2∈Fc: (Identical to Testing Phase 3.) Here, tensor product between q1 and q2 are flattened to the vector.
g(r)=⟨(q1⊗q2),u)⟩=?⟨u′′,q2⟩
For example, when r=2 and c=2, the equation holds due to the following reasoning:
The proof generation time depends on the encoding and commitment operations. Since Merkle Tree is used for commitments, as long as encoding is performed in linear time, the overall execution time is O(N).
The proof structure consists of:
c: Fields used in Testing Phase Step 2 and Evaluation Phase Step 3.
r⋅l: Fields sampled during Testing Phase Step 3 and Evaluation Phase Step 4.
α: Opening proof size required for l-queries.
Verification time is O(r⋅l). While proof generation is fast, the proof size and verification time is directly proportional with r.
Linear-time Encoding
The figure above illustrates the linear-time encoding method used in Brakedown. For a given rate ρ, Enc(x) is a function that generates a vector of length n⋅ρ−1 from an input vector x of length n. The output is divided into three parts: (x,z,v). The encoding Enc(x) proceeds as follows:
Vec Enc(Vec x) {
if (x.size() < 900) {
// As mentioned in Section 5 of the paper,
// the threshold is set at 900.
// Quadratic-time operations are acceptable here
// since their time contribution is negligible.
return RSEnc(x);
}
// A is a sparse matrix.
Matrix A = SampleMatrixA();
CHECK_EQ(A.rows(), x.size());
CHECK_EQ(A.cols(), kAlpha * x.size());
Vec y = x * A ;
Vec z = Enc(y);
// B is a sparse matrix.
Matrix B = SampleMatrixB();
CHECK_EQ(B.rows(), z.size());
CHECK_EQ(B.cols(), (kRateInv * - 1 - kAlpha * kRateInv) * x.size());
Vec v = z * B;
return Concatenate(x, z, v);
}
Properties of the Encoded Output
For the encoded result w=Enc(x), given the parameter β, the zero norm ∥w∥0 and distance δ are given by:
∥w∥0>βn, δ=(βn)/(nρ−1)=β/r
∥x∥0=#{i∣xi=0}
The execution time of encoding is proportional to the input vector x's length. Proofs related to this encoding method are detailed in Section 5.1 of the paper.
Linear-time Commitments for Sparse Multilinear Polynomials
Representing the Vector as a Sparse Matrix
For example, the vector can be converted into a matrix as follows. Here, Rows = 4, Cols = 4, Non-zero Elements (N) = 4, Total Elements (M) = 16:
D(rx,ry)=k={0,1}logN∑val(k)⋅eq(b−1(row(k)),rx)⋅eq(b−1(col(k)),ry),where val(k)=Vk,row(k)=Rk,col(k)=Ck,b−1:canonical injection from F to {0,1}logM,eq(x,y)={1,0,if x=yotherwise
Here is an example calculation of row, col, val and b−1 based on the previous example of a sparse matrix.
To verify the prover's claims of Erx and Ery, an Offline Memory Checking method is employed (refer to "Detour: offline memory checking" in Section 6 of the paper for details).
Reduction of R1CS to Sumcheck
Brakedown is a proving scheme for R1CS. Since the sumcheck protocol is integral to Brakedown, R1CS must be reduced to a sumcheck format. R1CS is defined as:
A⋅Z∘B⋅Z=C⋅Z, where A,B,C∈FqM×M and Z∈FqM
This can be converted into a sumcheck format as follows (simplified for illustration; see Section 7 for details):
Brakedown introduces linear-time encoding and linear-time commitment for generating proofs for R1CS, enabling proof generation with O(N) field operations. However, as mentioned earlier, the proof size is large, and the verification time is slow. These characteristics are evident in the following results:
The figure above, taken from the paper, benchmarks the performance of Brakedown's Polynomial Commitment Scheme. As shown, while Commit and Open operations are as fast as Ligero, the Verify and Communication stages are the slowest among the compared schemes.
This figure, also taken from the paper, shows that Brakedown achieves the fastest prove time and is among the fastest for encode time. However, it also confirms that verify remains slow, and the proof size is the largest.
The zero norm, also known as, represents the number of non-zero elements in x:
Using techniques from, the input vector can be committed in linear time.
Brakedown has since been improved and used in subsequent works, including,,, and.