Try   HackMD

Sin7Y Tech Review (28): Specification for Marlin

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Arkworks for Marlin
Marlin
Fractal

R1CS

Zero-knowledge proof algorithm Marlin is a R1CS based proof system, that, given a coefficient matrix parameter

I=(F,n,m,A,B,C) and a set of valid assignments
z=(x,w)Fn
,among which x is public information, namely Instance and is private information, namely, witness if
AzBz=Cz
is established, R1CS is established.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

If we let

zA=Az,zB=Bz,zC=Cz the above formula can be transformed into
zAzB=zC

Therefore, if we can prove that there are four vectors

zA,zB,zC,z that satisfy

zAzB=zCzA=AzzB=BzzC=Cz

R1CS is established.

Transition into Polynomial (efficiency)

Prepare

  1. Vanish polynomial
    vH(X)=X|H|1
  2. Derivative of Vanish polynomal
    μH(X,Y)=vH(X)vH(Y)XY

It’s a non-zero value if and only if

X=Y

Define polynomial

  1. Define polynomials(LDE)
    z^A(X),z^B(X),z^C(X)F<|H|+b[X]
    for vectors
    zA,zB,zC
    satisfying that the value on the group H is consistent with the vector, where the order of the group
    H
    are equal to the length of the vector (assuming they are both ), that is:
    z^A(g0)=zA[0],z^B(X)(g0)=zB[0],z^C(X)(g0)=zC[0]z^A(g1)=zA[1],z^B(X)(g1)=zB[1],z^C(X)(g1)=zC[1]...z^A(gn1)=zA[n1],z^B(X)(gn1)=zB[n1],z^C(X)(gn1)=zC[n1]

    Add
    b
    redundant point without exposing any information of
    w
  2. Define polynomial(LDE)for vector
    z=(x,w)
  3. Define a polynomial
    x^(X)F<|H[|x|]|[X]
    for
    x
    ,satisfying
    x^(g0)=x[0]x^(g1)=x[1]...x^(g|x|1)=x[|x|1]
  4. Define a polynomial for
    w

    γH[|x|]w¯:=w(γ)x^(γ)vH[|x|](γ)

    Define a polynomial
    w^(X)
    (LDE)for a vector
    w¯
    ,satisfying
    w^(g|x|)=w¯[|x|]w^(g|x|+1)=w¯[|x|+1]...w^(g|H|1)=w¯[|H|1]

Then the polynomial

z^(X)is
z^(X)=w^(X)VH[|x|](X)+x^(X)

  1. Define Polynomials for Matrices
    A,B,C
    (Holographic)
    In order to reduce the computational complexity for the verifier (see paper 5.2.1 ), we use a special form to represent the matrix. Below is an example using matrix A.
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Define:

row^(k):=ϕ1(tk)col^(k):=ϕ1(tk)val^(k):kth nonzero value

Where

tk is the row index of the kth non-zero value of the matrix,
ϕ1(tk)[|H|]H
maps the index to the computational domain,and
val^(k)
is the kth non-zero value of the matrix,which can be divisible by
μH(row^(k),row^(k))μH(col^(k),col^(k))

Therefore, a polynomial can be expressed as

M^(X,Y)=kKμH(X,row^(k))μH(Y,col^(k))val(k)^

Linearity check

In order to prove

z^A(X)=Az^(X),define the polynomial
q(X)=r(a,X)z^A(X)kHr(a,k)A(k,X)z^(X)

Which should satisfy

XHq(X)=XH(r(a,X)z^A(X)kHr(a,k)A(k,X)z^(X))=0

The relationship among

z^A(X),A,z^(X)in the group H is as shown in the following figure

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Now, we multiply a factor

r(α,X)for each element of
z^A(X)
on group
H
,then in order to ensure balance, we should multiply a factor
r(α,X)
for the
Az^(X)
which is as shown in the following figure

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

It can be seen that when the polynomial

t(X)traverses the value of group
H
, the following is satisfied
XHq(X)=XH(r(a,X)z^A(X)kHr(a,k)A(k,X)z^(X))=0

Likewise, we can also derive it from the formula

XHq(X)=XH(r(a,X)z^A(X)kHr(a,k)A(k,X)z^(X))=XHr(a,X)z^A(X)XHkHr(a,k)A(k,X)z^(X)=XHr(a,X)z^A(X)kHr(a,k)XHA(k,X)z^(X)=kHr(a,k)(z^A(k)XHA(k,X)z^(X))=?0
That is, if it can be proved that the accumulation of polynomials
q(X)
on group
H
is 0, the linear relationship among
z^A(X),A,z^(X)
is established.

AHP for R1CS

Common

Given a polynomial

z^A(X),z^B(X),z^C(X)F<|H|+b[X]w^(X)F<|H[>|x|]|+b[X]row^A(X),row^B(X),row^C(X)col^A(X),col^B(X),col^C(X)val^A(X),val^B(X),val^C(X)
Compute polynomial
h0(X)
satisfying
z^A(X)z^B(X)z^C(X)=h0(X)vH(X)

Generate random polynomials
s(X)F2|H|+b1[X], kHs(k)=δ1

Prover

=> Prover
a. Commit to

z^A(X),z^B(X),z^C(X),w^(X),h0(X),s(X)
b. Transcript.write
δ1,cm

=> Oracle

Generate random numbers

α,ηA,ηB,ηC

=> Prover - sumcheck-1

Sumcheck for

XHs(X)+r(a,X)(MηMz^M(X))(MηMrM(a,X)z^(X))
c. Compute polynomials
h1(X)
and
g1(X)
such that
s(X)+r(a,X)(MηMz^M(X))(MηMrM(a,X)z^(X))=h1(X)vH(X)+Xg1(X)+δ1/|H|

d. Commit to
h1(X),g1(X)

e. Transcript.write
cm_h1,cm_g1

=> Oracle

Generate random number

β1

=> Prover - sumcheck-1
a. Compute

s(β1),h1(β1),g1(β1),z^A(β1),z^B(β1),z^C(β1),w^(β1)
b. If we send these numbers to the verifier, the verifier needs to compute
       i.
vH(β1),vH[|x|](β1),r(α,β1)

       ii.
z^(β1)=w^(β1)vH[|x|](β1)+x^(β1)

       iii.
=ηArA(α,β1)+ηBrB(α,β1)+ηCrC(α,β1)=ηAkHr(α,k)A^(k,β1)+ηBkHr(α,k)B^(k,β1)+ηCkHr(α,k)C^(k,β1)=kHr(α,k)(ηAA^(k,β1)+ηBB^(k,β1)+ηCC^(k,β1))

Its computational complexity is

Ω(|H||K|),therefore,this part of the calculation needs to be executed by the Prover as a proxy.

=> Prover -sumcheck-2

Sumcheck for

XHr(α,X)(ηAA^(X,β1)+ηBB^(X,β1)+ηCC^(X,β1))
a. Compute polynomials
h2(X)
and
g2(X)
such that
r(α,X)(ηAA^(X,β1)+ηBB^(X,β1)+ηCC^(X,β1))=h2(X)vH(X)+Xg2(X)+δ2/|H|

b. Commit to
h2(X),g2(X)

c. Transcript.write
δ2,cm_h2,cm_g2

=> Oracle

Generate random number

β2

=> Prover - sumcheck-2
a. Compute

h2(β2),g2(β2)
b. If we send these numbers to the verifier, the verifier needs to compute
       i.
vH(β2),r(α,β2)

       ii.
A^(β2,β1),B^(β2,β1),C^(β2,β1)

Its computational complexity is
Ω(|K|)
,therefore,this part of the calculation needs to be executed by Prover as a proxy.

=> Prover - sumcheck-3

Sumcheck for

ηAA^(β2,β1)+ηBB^(β2,β1)+ηCC^(β2,β1)=kKMA,B,CηMvH(β2)vH(β1)val^(k)(β2row^M(k))(β1col^M(k))
Define the polynomial
f3(k)=MA,B,CηMvH(β2)vH(β1)val^(k)(β2row^M(k))(β1col^M(k)),kK

a. Compute polynomials
h3(x)
and
g3(x)
such that
f3(X)=Xg3(X)+δ3/|K|a(X)b(X)f3(X)=h3(X)vK(X)

which can be combined as:
a(X)b(X)(Xg3(X)+δ3/|K|)=h3(X)vK(X)

where

a(X)=MA,B,CηMvH(β2)vH(β1)val^(X)N{A,B,C}exp{M}(β2row^N(X))(β1col^N(X))b(X)=M{A,B,C}(β2row^M(X))(β1col^M(X))

b. Commit to

h3(x),g3(x)
c. Transcript.write
δ3,cm_h3,cm_g3

=> Oracle

Generate random number

β3

=> Prover - sumcheck-3
a. Compute

h3(β3),g3(β3),row^A(β3),row^B(β3),row^C(β3)col^A(β3),col^B(β3),col^C(β3)val^A(β3),val^B(β3),val^C(β3)
b. Send to the verifier

Verifier

=> Verifier-sumcheck-3

a. Compute
       i.

vK(β3)
       ii.
a(β3)=MA,B,CηMvH(β2)vH(β1)val^(β3)N{A,B,C}exp{M}(β2row^N(β3))(β1col^N(β3))b(β3)=M{A,B,C}(β2row^M(β3))(β1col^M(β3))

b. Verify
a(β3)b(β3)(β3g3(β3)+δ3/|K|)=? h3(β3)vK(β3)

If it passes the verification, it means that the value computed by the Prover
ηAA^(β2,β1)+ηBB^(β2,β1)+ηCC^(β2,β1)=kKMA,B,CηMvH(β2)vH(β1)val^(k)(β2row^M(k))(β1col^M(k))=δ3

is valid, then go to the previous level for verification.

=> Verifier-sumcheck-2

Recall the equality

r(α,X)(ηAA^(X,β1)+ηBB^(X,β1)+ηCC^(X,β1))=h2(X)vH(X)+Xg2(X)+δ2/|H|

a. Compute
       i.

vH(β2)
b. Verify
r(α,β2)δ3=? h2(β2)vH(β2)+β2g2(β2)+δ2/|H|

If it passes the verification, it means that the value computed by the Prover
XHr(α,X)(ηAA^(X,β1)+ηBB^(X,β1)+ηCC^(X,β1))=δ2

is valid, then go to the previous level for verification.

=> Verifier-sumcheck-1

Recall the equality

s(X)+r(a,X)(MηMz^M(X))(MηMrM(a,X)z^(X))=h1(X)vH(X)+Xg1(X)+δ1/|H|
a. Compute
      i.
vH(β1)

      ii.
r(α,β1)

      iii.
vH[|x|](β1)

      iv.
z^(β1)=w^(β1)vH[|x|](β1)+x^(β1)

b. Verify
s(β1)+r(a,β1)(MηMz^M(β1))β2z^(β1))=?h1(β1)vH(β1)+β1g1(β1)+δ1/|H|

If it passes the verification,it means that the polynomials
z^A(X),z^B(X),z^C(X)
and
z^(X)
satisfy a linear relationship.

=> Verifier

Verify

z^A(β1)z^B(β1)z^C(β1)=h0(β1)vH(β1)

Polynomial commitment

The protocol has carried out three rounds of interaction in total. The polynomials of each round of interaction commitment and the query points are as follows:

Sumcheck - 1

β1{s(β1),h1(β1),g1(β1),w^(β1),z^A(β1),z^B(β1),z^C(β1)}

Sumcheck - 2

β2{h2(β2),g2(β2)}

Sumcheck - 3

β3{h3(β3),g3(β3),row^A(β3),row^B(β3),row^C(β3)col^A(β3),col^B(β3),col^C(β3)val^A(β3),val^B(β3),val^C(β3)}

Extended KZG10 (cross multi-poly)

Optimization

Sum(s(X)) = 0

Generate random polynomials

s(X)F3|H|+2b2[X], kHs(k)=0
Then, forsumcheck - 1

Reduce sumcheck

According to the optimization mentioned in the paper COS20. Claim6.7(Fractal)we make

r(X,Y)=μH(X,Y)rM(X,Y)=M(Y,X)M(X,Y)=αHbHLα,H(X)Lb,H(Y)Mb,aμH(b,b)
For matrices
A,B,C
,the transformed matrices are

Aa,b=Ab,aμ(b,b)Ba,b=Bb,aμ(b,b)Ca,b=Cb,aμ(b,b)

Define polynomial

t(X)
t(X):=MηMrM(a,X)

Then, for sumcheck - 1,the formula becomes
XHs(X)+r(α,X)(MηMz^M(X))(MηMrM(α,X)z^(X))=XHs(X)+μ(α,X)(MηMz^M(X))t(X)z^(X)

Common

Given the polynomial

z^A(X),z^B(X),z^C(X)F<|H|+b[X]w^(X)F<|H[>|x|]|+b[X]row^A(X),row^B(X),row^C(X)col^A(X),col^B(X),col^C(X)val^A(X),val^B(X),val^C(X)
Compute polynomial
h0(X)
satisfying
z^A(X)z^B(X)z^C(X)=h0(X)vH(X)

Generate random polynomials
s(X)F2|H|+b1[X], kHs(k)=δ1

Prover

=> Prover

a. Commit to

z^A(X),z^B(X),z^C(X),w^(X),h0(X),s(X)
b. Transcript.write
δ1,cm

=> Oracle

Generate random number

α,ηA,ηB,ηC

=> Prover-sumcheck - 1

Sumcheck for

XHs(X)+μ(α,X)(MηMz^M(X))t(X)z^(X)

a. Compute polynomials

h1(X) and
g1(X)
such that:
s(X)+μ(a,X)(MηMz^M(X))t(X)z^(X))=h1(X)vH(X)+Xg1(X)+\soutδ1/|H|

b. Commit to
h1(X),g1(X)

c. Transcript.write
cm_h1,cm_g1

=> Oracle

Generate random number

β1

=> Prover-sumcheck - 1

a. Compute

s(β1),h1(β1),g1(β1),z^A(β1),z^B(β1),z^C(β1),w^(β1)
b. i. If we send these numbers to the verifier, the verifier needs to compute
      i.
vH(β1),vH[|x|](β1),r(α,β1)

      ii.
z^(β1)=w^(β1)vH[|x|](β1)+x^(β1)

      iii.
t(β1)=ηAA(β1,α)+ηBB(β1,α)+ηCC(β1,α)

Its computational complexity is

Ω(|K|),Therefore, this part of the calculation needs to be executed by Prover as a proxy.

=> Prover - sumcheck-2

Sumcheck for

ηAA(β1,α)+ηBB(β1,α)+ηCC(β1,α)=kKMA,B,CηMvH(β1)vH(α)val^M(k)(β1row^M(k))(αcol^M(k))
Define the polynomial
f2(k)=MA,B,CηMvH(β1)vH(α)val^M(k)(β1row^M(k))(αcol^M(k)),kK

a. Compute polynomials
h2(x)
and
g2(x)
such that
f2(X)=Xg2(X)+δ2/|K|a(X)b(X)f2(X)=h2(X)vK(X)

which can be combined as

a(X)b(X)(Xg2(X)+t(β1)/|K|)=h2(X)vK(X)

where

a(X)=MA,B,CηMvH(β1)vH(α)val^M(X)N{A,B,C}exp{M}(β1row^N(X))(αcol^N(X))b(X)=M{A,B,C}(β1row^M(X))(αcol^M(X))
b. Commit to
h2(x),g2(x)

c. Transcript.write
t(β1),cm_h2,cm_g2

=> Oracle

Generate random number

β2

=> Prover - sumcheck-2

  1. Compute
    h2(β2),g2(β2),row^A(β2),row^B(β2),row^C(β2)col^A(β2),col^B(β2),col^C(β2)val^A(β2),val^B(β2),val^C(β2)
  2. b. Send them to the verifier

Verifier

=> Verifier sumcheck - 2

  1. Compute
    a.
    vK(β2)

    b.
    a(β2)=MA,B,CηMvH(β1)vH(α)val^M(β2)N{A,B,C}exp{M}(β1row^N(β2))(αcol^N(β2))b(β2)=M{A,B,C}(β1row^M(β2))(αcol^M(β2))
  2. Verify
    a(β2)b(β2)(β2g2(β2)+t(β1)/|K|)=? h2(β2)vK(β2)

If it passes the verification, it means that the calculation

t(β1)calculated by the Prover is valid, then it goes up to the previous verification.

=> Verifier sumcheck - 1

Recall the equality

a. Compute
      i.

vH(β1)
      ii.
μ(α,β1)

      iii.
vH[|x|](β1)

      iv.
z^(β1)=w^(β1)vH[|x|](β1)+x^(β1)

  1. Verify
    s(β1)+μ(a,β1)(MηMz^M(β1))t(β1)z^(β1)=?h1(β1)vH(β1)+β1g1(β1)

    If it passes the verification, it means that the polynomials
    z^A(X),z^B(X),z^C(X)
    and
    z^(X)

    satisfy a linear relationship.

=> Verifier

Verify

z^A(β1)z^B(β1)z^C(β1)=h0(β1)vH(β1)

Reduce polynomial numbers for Sumcheck - 2

Compress the current verification of the three matrices into the verification of one matrix, namely

M=ηAA+ηBB+ηCC

Represent this polynomial as a sparse matrix.

Matrix polynomials are reduced from 9 to 3.

Set b = 1

Set b = 1

Final Procotol

Marlin in Arkworks