Example 1

Assume the following sample code: mul R1, R1, 5 => Gate 1, p=181 add R1, R1, 11 => Gate 2, p=181 mul R1, R1, 26 => Gate 3, p=181

The constraints are as follows considering p=181p=181:

R1(2)5R1(1)=0R_1^{(2)}-5R_1^{(1)}=0 R1(3)R1(2)11=0R_1^{(3)}-R_1^{(2)}-11=0 R1(4)26R1(3)=0R_1^{(4)}-26R_1^{(3)}=0

To keep the example simple and understandable, we continue with ng=3n_g=3 and ni=1n_i=1.

The Prover calculates square matrices AA, BB and CC of order ng+ni+1=3+1+1=5n_g+n_i+1=3+1+1=5 based on above construction:

A=[0000000000010001000000010]A=\begin{bmatrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0&1&0&0&0\\ 1&0&0&0&0\\ 0&0&0&1&0 \end{bmatrix}
B=[000000000050000110100260000]B=\begin{bmatrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 5&0&0&0&0\\ 11&0&1&0&0\\ 26&0&0&0&0 \end{bmatrix}
C=[0000000000001000001000001]C=\begin{bmatrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0&0&1&0&0\\ 0&0&0&1&0\\ 0&0&0&0&1 \end{bmatrix}

At we see, the matrices AA and BB are 2SLT2-SLT and matrix CC is 2Diag2-Diag. Also AzoBz=CzAz\hspace{1mm}o\hspace{1mm}Bz=Cz.

We consider multiplicative subgroup H\mathbb{H} of order n=ng+ni+1=5n=n_g+n_i+1=5 with generator ω=23659(mod181)\omega=2^{36}\equiv 59 (\textrm{mod}\hspace{1mm}181). Note that if gg is a generator of field F\mathbb{F} of order pp, then, gp1ng^{\frac{p-1}{n}} is a generator of a multiplicative subgroup of it of order nn. Therefore, H=\mathbb{H}= { 1,ω,ω2,ω3,ω41,\omega,\omega^2,\omega^3,\omega^4 } = { 1,59,42,125,1351,59,42,125,135 }.

Also, consider multiplicative subgroup K\mathbb{K} of order m=2ng=6m=2n_g=6 where t=ni+1=2t=n_i+1=2 with generator γ=gp1m=23049(mod181)\gamma=g^{\frac{p-1}{m}}=2^{30}\equiv49(\textrm{mod}\hspace{1mm}181). Therefore, K=\mathbb{K}= { 1,γ,γ2,...,γ51,\gamma,\gamma^2,...,\gamma^5 } = { 1,49,48,180,132,1331,49,48,180,132,133 } .

PFR Commitment

Commit(ck=(2,66,83,91,96,24,2,66,83),mf=(A,B,C),sR)Commit(ck=(2,66,83,91,96,24,2,66,83),m_f=(A,B,C),s\in R):

1- The Prover Selects s=(s1,...,ssAHP(0))s=(s_1,...,s_{s_{AHP}(0)}) of random space RR.

2- The Prover calculates O=Enc(mf=(A,B,C))\overrightarrow{O}=Enc(m_f=(A,B,C)) as encoded index as following:.

First, calculates the polynomial rowPFRA(x)row_{PFR_A}(x). Since matrix AA has three non-zero entries that the first of them is in the second row, so c0=2c_0=2 and rowPFRA(γ0)=ω2row_{PFR_A}(\gamma^0)=\omega^2 , note that rows numbered of zero, the second is in the third row, so c1=3c_1=3 and rowPFRA(γ1)=ω3row_{PFR_A}(\gamma^1)=\omega^3 and the third is in the fourth row, so c2=4c_2=4 and rowPFRA(γ2)=ω4row_{PFR_A}(\gamma^2)=\omega^4. Note that to construct all three polynomials, we read the entries in the matrix in row or column order. Here they are read in row order.

According to the values ​​defined for γ\gamma and ω\omega, we have rowPFRA(1)=42row_{PFR_A}(1)=42, rowPFRA(43)=125row_{PFR_A}(43)=125 and rowPFRA(39)=135row_{PFR_A}(39)=135. Therefore based on Lagrange polynomials, have rowPFRA(x)=i=13yiLi(x)row_{PFR_A}(x)=\sum_{i=1}^{3}y_iL_i(x), so rowPFRA(x)=42L1(x)+125L2(x)+135L3(x)row_{PFR_A}(x)=42L_1(x)+125L_2(x)+135L_3(x), where L1(x)=(x43)(x39)(143)(139)=(x43)(x39)(42)(38)L_1(x)=\frac{(x-43)(x-39)}{(1-43)(1-39)}=\frac{(x-43)(x-39)}{(-42)(-38)}. Now, since 42139(mod181)-42\equiv139\hspace{1mm}(\textrm{mod}\hspace{1mm}181), 38143(mod181)-38\equiv143\hspace{1mm}(\textrm{mod}\hspace{1mm}181), 43138(mod181)-43\equiv138\hspace{1mm}(\textrm{mod}\hspace{1mm}181) and 39142(mod181)-39\equiv142\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , therefore L1(x)=(x+138)(x+142)(139)(143)L_1(x)=\frac{(x+138)(x+142)}{(139)(143)} and since (139)(143)148(mod181)(139)(143)\equiv 148\hspace{1mm}(\textrm{mod}\hspace{1mm}181) and 1481170(mod181)148^{-1}\equiv 170\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , have L1(x)=170(x+138)(x+142)=170x2+178x+15L_1(x)=170(x+138)(x+142)=170x^2+178x+15 . We get in a similar way that L2(x)=167x2+17x+178L_2(x)=167x^2+17x+178 and L3(x)=25x2+167x+170L_3(x)=25x^2+167x+170 . Therefore rowPFRA(x)=77x2+109x+37row_{PFR_A}(x)=77x^2+109x+37 .

Now, calculates colPFRA(x)col_{PFR_A}(x). Since matrix AA has three non-zero entries that the first of them is in the first column, so r0=1r_0=1 and colPFRA(γ0)=ω1col_{PFR_A}(\gamma^0)=\omega^1 , note that columns numbered of zero, the second is in the zero column, so r1=0r_1=0 and colPFRA(γ1)=ω0col_{PFR_A}(\gamma^1)=\omega^0 and the third is in the third column, so r2=3r_2=3 and colPFRA(γ2)=ω3col_{PFR_A}(\gamma^2)=\omega^3. Therefore colPFRA(1)=59col_{PFR_A}(1)=59, colPFRA(43)=1col_{PFR_A}(43)=1 and colPFRA(39)=125col_{PFR_A}(39)=125. So colPFRA(x)=59L1(x)+L2(x)+125L3(x)=109x2+81x+50col_{PFR_A}(x)=59L_1(x)+L_2(x)+125L_3(x)=109x^2+81x+50.

Now, calculates valPFRA(x)val_{PFR_A}(x). Since matrix AA has three non-zero entries such that the value of all of them is one, therefore v0=v1=v2=1v_0=v_1=v_2=1. So, valPFRA(x)=L1(x)+L2(x)+L3(x)=1val_{PFR_A}(x)=L_1(x)+L_2(x)+L_3(x)=1.

Therefore, the matrix AA is encoded by rowPFRA(x)=77x2+109x+37row_{PFR_A}(x)=77x^2+109x+37, colPFRA(x)=109x2+81x+50col_{PFR_A}(x)=109x^2+81x+50 and valPFRA(x)=1val_{PFR_A}(x)=1.

Now, encodes the matrix BB. First, calculates the polynomial rowPFRB(x)row_{PFR_B}(x). Since matrix BB has four non-zero entries such that the first of them is in the second row, so c0=2c_0=2 and rowPFRB(γ0)=ω2row_{PFR_B}(\gamma^0)=\omega^2 . The second and the third are in the third row, so c1=c2=3c_1=c_2=3 and rowPFRB(γ1)=rowPFRB(γ2)=ω3row_{PFR_B}(\gamma^1)=row_{PFR_B}(\gamma^2)=\omega^3 and the fourth is in the fourth row, so c3=4c_3=4 and rowPFRB(γ3)=ω4row_{PFR_B}(\gamma^3)=\omega^4. Therefore, rowPFRB(1)=42row_{PFR_B}(1)=42, rowPFRB(43)=125row_{PFR_B}(43)=125, rowPFRB(39)=125row_{PFR_B}(39)=125 and rowPFRB(48)=135row_{PFR_B}(48)=135. So rowPFRB(x)=42L1(x)+125L2(x)+125L3(x)+135L4(x)row_{PFR_B}(x)=42L_1(x)+125L_2(x)+125L_3(x)+135L_4(x) where L1(x)=(x43)(x39)(x48)(143)(139)(148)=(x+138)(x+142)(x+133)(139)(143)(134)=(x+138)(x+142)(x+133)103L_1(x)=\frac{(x-43)(x-39)(x-48)}{(1-43)(1-39)(1-48)}=\frac{(x+138)(x+142)(x+133)}{(139)(143)(134)}=\frac{(x+138)(x+142)(x+133)}{103}. Since 103158(mod181)103^{-1}\equiv58\hspace{1mm}(\textrm{mod}\hspace{1mm}181), so L1(x)=58(x+138)(x+142)(x+133)=58x3+62x2+116x+127L_1(x)=58(x+138)(x+142)(x+133)=58x^3+62x^2+116x+127. We get in a similar way that L2(x)=39x3+7x2+19x+116L_2(x)=39x^3+7x^2+19x+116, L3(x)=138x3+155x2+7x+62L_3(x)=138x^3+155x^2+7x+62 and L4(x)=127x3+138x2+39x+58L_4(x)=127x^3+138x^2+39x+58. Therefore rowPFRB(x)=76x3+35x2+174x+119row_{PFR_B}(x)=76x^3+35x^2+174x+119.

Now, calculates colPFRB(x)col_{PFR_B}(x). Since matrix BB has four non-zero entries that the first, second and fourth of them are in zero column, so r0=r1=r3=0r_0=r_1=r_3=0 and colPFRB(γ0)=colPFRB(γ1)=colPFRB(γ3)=ω0col_{PFR_B}(\gamma^0)=col_{PFR_B}(\gamma^1)=col_{PFR_B}(\gamma^3)=\omega^0 and the third is in the second column, so r2=2r_2=2 and colPFRB(γ2)=ω2col_{PFR_B}(\gamma^2)=\omega^2 . Therefore colPFRB(1)=1col_{PFR_B}(1)=1, colPFRB(43)=1col_{PFR_B}(43)=1, colPFRB(39)=42col_{PFR_B}(39)=42 and colPFRB(48)=1col_{PFR_B}(48)=1. So colPFRB(x)=L1(x)+L2(x)+42L3(x)+L4(x)=47x3+20x2+106x+9col_{PFR_B}(x)=L_1(x)+L_2(x)+42L_3(x)+L_4(x)=47x^3+20x^2+106x+9.

Now, calculates valPFRB(x)val_{PFR_B}(x). Since matrix BB has four non-zero entries that value of them are 55, 1111, 11 and 2626, respectively. Therefore v0=v1=v2=1v_0=v_1=v_2=1 valPFRB(γ0)=5val_{PFR_B}(\gamma^0)=5, valPFRB(γ1)=11val_{PFR_B}(\gamma^1)=11, valPFRB(γ2)=1val_{PFR_B}(\gamma^2)=1 and valPFRB(γ3)=26val_{PFR_B}(\gamma^3)=26. So, valPFRB(1)=5val_{PFR_B}(1)=5, valPFRB(43)=11val_{PFR_B}(43)=11, valPFRB(39)=1val_{PFR_B}(39)=1 and valPFRB(48)=26val_{PFR_B}(48)=26. Therefore, valPFRB(x)=5L1(x)+11L2(x)+L3(x)+26L4(x)=177x3+148x2+42val_{PFR_B}(x)=5L_1(x)+11L_2(x)+L_3(x)+26L_4(x)=177x^3+148x^2+42.

Therefore, the matrix BB is encoded by rowPFRB(x)=76x3+35x2+174x+119row_{PFR_B}(x)=76x^3+35x^2+174x+119, colPFRB(x)=47x3+20x2+106x+9col_{PFR_B}(x)=47x^3+20x^2+106x+9 and valPFRB(x)=177x3+148x2+42val_{PFR_B}(x)=177x^3+148x^2+42.

Now, calculates polynomial rowPFRC(x)row_{PFR_C}(x). In a similar way, Since matrix CC has three non-zero entries that are in the third, fourth and fifth rows, therefore rowPFRC(γ0)=ω2row_{PFR_C}(\gamma^0)=\omega^2 , rowPFRC(γ1)=ω3row_{PFR_C}(\gamma^1)=\omega^3 and rowPFRC(γ2)=ω4row_{PFR_C}(\gamma^2)=\omega^4. Then rowPFRC(1)=42row_{PFR_C}(1)=42 , rowPFRC(43)=125row_{PFR_C}(43)=125 and rowPFRC(39)=135row_{PFR_C}(39)=135. So rowPFRC(x)=42L1(x)+125L2(x)+135L3(x)row_{PFR_C}(x)=42L_1(x)+125L_2(x)+135L_3(x), therefore rowPFRC(x)=77x2+109x+37row_{PFR_C}(x)=77x^2+109x+37.

Now, since CC is a diagonal matrix, polynomials rowPFRC(x)row_{PFR_C}(x) and colPFRC(x)col_{PFR_C}(x) are equal. Also, since the matrix CC has three non-zero entries such that the value of all of them is one, therefore v0=v1=v2=1v_0=v_1=v_2=1. So, valPFRC(x)=L1(x)+L2(x)+L3(x)=1val_{PFR_C}(x)=L_1(x)+L_2(x)+L_3(x)=1.

Therefore, the matrix CC is encoded by rowPFRC(x)=77x2+109x+37row_{PFR_C}(x)=77x^2+109x+37, colPFRC(x)=77x2+109x+37col_{PFR_C}(x)=77x^2+109x+37 and valPFRC(x)=1val_{PFR_C}(x)=1. Therefore, encoding of mf=(A,B,C)m_f=(A,B,C) calculates as following: OPFR=(37,109,77,0,0,0,0,0,0,50,81,109,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,119,174,35,76,0,0,\overrightarrow{O}_{PFR}=(37,109,77,0,0,0,0,0,0,50,81,109,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,119,174,35,76,0,0,

3- The Prover calculates commitment by using of KZG commitment scheme as following:

ComT=i=0degTaigτi=i=0degTaick(i)Com_{T}=\sum_{i=0}^{deg_T}a_ig\tau^i=\sum_{i=0}^{deg_T}a_ick(i) where aia_i is coefficient of xix^i in polynomial T(x)T(x).

Therefore

ComPFR0=i=02rowPFRAi(gτi)=i=02rowPFRAick(i)=37ck(0)+109ck(1)+77ck(2)=37×2+109×57+77×86(mod181)Com_{PFR}^0=\sum_{i=0}^{2}row_{PFR_{A_i}}(g\tau^i)=\sum_{i=0}^{2}row_{PFR_{A_i}}ck(i)=37ck(0)+109ck(1)+77ck(2)=37\times2+109\times 57+77\times 86\equiv\hspace{1mm}(\textrm{mod}\hspace{1mm}181)

ComPFR1=Com_{PFR}^1=

ComPFR2=Com_{PFR}^2=

and similarly

ComPFR3=Com_{PFR}^3=, ComPFR4=Com_{PFR}^4=, ComPFR5=Com_{PFR}^5=, ComPFR6=Com_{PFR}^6=, ComPFR7=Com_{PFR}^7= and ComPFR8=Com_{PFR}^8=.

4- The Prover sends ComPFR=Com_{PFR}= to the Verifier.

AHP Commitment

Commit(ck,mf=(A,B,C),sR)Commit(ck,m_f=(A,B,C),s\in R):

1 - The Prover Selects s=(s1,...,ssAHP(0))s=(s_1,...,s_{s_{AHP}(0)}) of random space RR. 2- The Prover calculates OAHP=Enc(mf=(A,B,C))\overrightarrow{O}_{AHP}=Enc(m_f=(A,B,C)) as encoded index as following:

The polynomial rowAHPA:K=row_{AHP_A}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } with rowAHPA(k=γi)=ωrirow_{AHP_A}(k=\gamma^i)=\omega^{r_i} for 1iA1\leq i\leq ||A|| , and otherwise rowAHPA(k)row_{AHP_A}(k) returns an arbitrary element in H\mathbb{H}. So rowAHPA(k)row_{AHP_A}(k) on K\mathbb{K} is a polynomial so that rowAHPA(1)=42row_{AHP_A}(1)=42 , rowAHPA(49)=125row_{AHP_A}(49)=125, rowAHPA(48)=135row_{AHP_A}(48)=135 and otherwise rowAHPA(k)row_{AHP_A}(k) returns arbitrary elements of H\mathbb{H}, for example rowAHPA(180)=125row_{AHP_A}(180)=125, AHProwA(132)=135AHProw_A(132)=135, AHProwA(133)=1AHProw_A(133)=1 . Therefore, rowAHPA(x)=i=16yiLi(x)=162x5+62x4+161x3+169x2+88x+124row_{AHP_A}(x)=\sum_{i=1}^{6}y_iL_i(x)=162x^5+62x^4+161x^3+169x^2+88x+124.

Also, colAHPA:K=col_{AHP_A}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } with colAHPA(k=γi)=ωcicol_{AHP_A}(k=\gamma^i)=\omega^{c_i} for 1iA1\leq i\leq ||A|| and otherwise colAHPA(k)col_{AHP_A}(k) returns an arbitrary element in H\mathbb{H}. So colAHPA(k)col_{AHP_A}(k) on K\mathbb{K} is a polynomial so that colAHPA(1)=59col_{AHP_A}(1)=59 , colAHPA(49)=1col_{AHP_A}(49)=1, colAHPA(48)=125col_{AHP_A}(48)=125 and otherwise colAHPA(k)col_{AHP_A}(k) returns arbitrary elements of H\mathbb{H}, for example colAHPA(180)=125col_{AHP_A}(180)=125, colAHPA(132)=135col_{AHP_A}(132)=135 and colAHPA(133)=1col_{AHP_A}(133)=1. Therefore, colAHPA(x)=i=16yiLi(x)=128x5+150x4+32x3+109x2+169x+14col_{AHP_A}(x)=\sum_{i=1}^{6}y_iL_i(x)=128x^5+150x^4+32x^3+109x^2+169x+14

and , valAHPA:K=val_{AHP_A}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } with valAHPA(k=γi)=viuH(rowAHPA(k),rowAHPA(k))uH(colAHPA(k),colAHPA(k))val_{AHP_A}(k=\gamma^i)=\frac{v_i}{u_{\mathbb{H}}(row_{AHP_A}(k),row_{AHP_A}(k))u_{\mathbb{H}}(col_{AHP_A}(k),col_{AHP_A}(k))} for 1iA1\leq i\leq ||A|| where viv_i is value of ithi^{th} nonzero entry and otherwise valAHPA(k)val_{AHP_A}(k) returns zero. Note that based on definition of uH(x,y)u_{\mathbb{H}}(x,y), for each xHx \in \mathbb{H}, uH(x,x)=HxH1=5x4u_{\mathbb{H}}(x,x)=|\mathbb{H}|x^{|\mathbb{H}|-1}=5x^4. So valAHPA(1)=1(5rowAHPA4(1))(5colAHPA4(1))=15×424×5×594=11455(mod181)val_{AHP_A}(1)=\frac{1}{(5row_{AHP_A}^4(1))(5col_{AHP_A}^4(1))}=\frac{1}{5\times 42^4\times5\times59^4}=\frac{1}{145}\equiv 5\hspace{1mm}(\textrm{mod}\hspace{1mm}181), valAHPA(49)=1(5rowAHPA4(49))(5colAHPA4(49))=15×1254×5×14=11455(mod181)val_{AHP_A}(49)=\frac{1}{(5row_{AHP_A}^4(49))(5col_{AHP_A}^4(49))}=\frac{1}{5\times 125^4\times5\times1^4}=\frac{1}{145}\equiv 5\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , valAHPA(48)=1(5rowAHPA4(48))(5colAHPA4(48))=15×1354×5×1254=148132(mod181)val_{AHP_A}(48)=\frac{1}{(5row_{AHP_A}^4(48))(5col_{AHP_A}^4(48))}=\frac{1}{5\times 135^4\times5\times 125^4}=\frac{1}{48}\equiv 132\hspace{1mm}(\textrm{mod}\hspace{1mm}181) and valAHPA(k)=0val_{AHP_A}(k)=0 for kKk\in \mathbb{K}- { 1,49,481,49,48 }. Therefore valAHPA(x)=i=16yiLi(x)=72x5+79x4+22x3+111x2+180x+84val_{AHP_A}(x)=\sum_{i=1}^{6}y_iL_i(x)=72x^5+79x^4+22x^3+111x^2+180x+84.

Now, rowAHPA^\hat{row_{AHP_A}}, colAHPA^\hat{col_{AHP_A}} and valAHPA^\hat{val_{AHP_A}} are extensions of rowAHPArow_{AHP_A}, colAHPAcol_{AHP_A} and valAHPAval_{AHP_A} so that are agree on K\mathbb{K}.

Similarly, rowAHPB:K=row_{AHP_B}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } so that rowAHPB(1)=42row_{AHP_B}(1)=42, rowAHPB(49)=125row_{AHP_B}(49)=125, rowAHPB(48)=125row_{AHP_B}(48)=125, rowAHPB(180)=135row_{AHP_B}(180)=135 and for the rest values of K\mathbb{K}, rowAHPB(k)row_{AHP_B}(k) returns arbitrary elements of H\mathbb{H}, for example rowAHPB(132)=135row_{AHP_B}(132)=135 and rowAHPB(133)=1row_{AHP_B}(133)=1. Therefore rowAHPB(x)=i=16yiLi(x)=20x5+85x4+37x3+151x2+168x+124row_{AHP_B}(x)=\sum_{i=1}^{6}y_iL_i(x)=20x^5+85x^4+37x^3+151x^2+168x+124.

Also, colAHPB:K=col_{AHP_B}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } so that colAHPB(1)=1col_{AHP_B}(1)=1 , colAHPB(49)=1col_{AHP_B}(49)=1, colAHPB(48)=42col_{AHP_B}(48)=42, colAHPB(180)=1col_{AHP_B}(180)=1 and for the rest values of K\mathbb{K} , colAHPB(k)col_{AHP_B}(k) returns arbitrary elements of H\mathbb{H}, for example colAHPB(132)=135col_{AHP_B}(132)=135 and colAHPB(133)=1col_{AHP_B}(133)=1. Therefore colAHPB(x)=i=16yiLi(x)=18x5+164x4+180x3+18x2+164xcol_{AHP_B}(x)=\sum_{i=1}^{6}y_iL_i(x)=18x^5+164x^4+180x^3+18x^2+164x

and , valAHPB:K=val_{AHP_B}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } so that valAHPB(1)=5(5rowAHPB4(1))(5colAHPB4(1))=55×424×5×14=548117(mod181)val_{AHP_B}(1)=\frac{5}{(5row_{AHP_B}^4(1))(5col_{AHP_B}^4(1))}=\frac{5}{5\times 42^4\times5\times1^4}=\frac{5}{48}\equiv 117\hspace{1mm}(\textrm{mod}\hspace{1mm}181), valAHPB(49)=11(5rowAHPB4(49))(5colAHPB4(49))=115×1254×5×14=1114555(mod181)val_{AHP_B}(49)=\frac{11}{(5row_{AHP_B}^4(49))(5col_{AHP_B}^4(49))}=\frac{11}{5\times 125^4\times5\times1^4}=\frac{11}{145}\equiv 55\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , valAHPB(48)=1(5rowAHPB4(48))(5colAHPB4(48))=15×1254×5×424=12529(mod181)val_{AHP_B}(48)=\frac{1}{(5row_{AHP_B}^4(48))(5col_{AHP_B}^4(48))}=\frac{1}{5\times 125^4\times5\times 42^4}=\frac{1}{25}\equiv 29\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , valAHPB(180)=26(5rowAHPB4(180))(5colAHPB4(180))=265×1354×5×14=262768(mod181)val_{AHP_B}(180)=\frac{26}{(5row_{AHP_B}^4(180))(5col_{AHP_B}^4(180))}=\frac{26}{5\times 135^4\times5\times 1^4}=\frac{26}{27}\equiv 68\hspace{1mm}(\textrm{mod}\hspace{1mm}181) and valAHPB(k)=0val_{AHP_B}(k)=0 for kK{1,49,48,180}k\in \mathbb{K}-\{1,49,48,180\}. Therefore valAHPB(x)=i=16yiLi(x)=86x5+53x4+34x3+55x2+176x+75val_{AHP_B}(x)=\sum_{i=1}^{6}y_iL_i(x)=86x^5+53x^4+34x^3+55x^2+176x+75.

Now, rowAHPB^\hat{row_{AHP_B}}, colAHPB^\hat{col_{AHP_B}} and valAHPB^\hat{val_{AHP_B}} are extensions of rowAHPBrow_{AHP_B}, colAHPBcol_{AHP_B} and valAHPBval_{AHP_B} so that are agree on K\mathbb{K}.

Similarly, rowAHPC:K=row_{AHP_C}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } so that rowAHPC(1)=42row_{AHP_C}(1)=42, rowAHPC(49)=125row_{AHP_C}(49)=125, rowAHPC(48)=135row_{AHP_C}(48)=135 and for the rest values of K\mathbb{K}, rowAHPC(k)row_{AHP_C}(k) returns arbitrary elements of H\mathbb{H}, for example rowAHPC(180)=125row_{AHP_C}(180)=125, rowAHPC(132)=135row_{AHP_C}(132)=135 and rowAHPC(133)=1row_{AHP_C}(133)=1. Therefore rowAHPC(x)=i=16yiLi(x)=162x5+62x4+161x3+169x2+88x+124row_{AHP_C}(x)=\sum_{i=1}^{6}y_iL_i(x)=162x^5+62x^4+161x^3+169x^2+88x+124.

Also, colAHPC:K=col_{AHP_C}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 }so that colAHPC(1)=42col_{AHP_C}(1)=42 , colAHPC(49)=125col_{AHP_C}(49)=125, colAHPC(48)=135col_{AHP_C}(48)=135, colAHPC(180)=125col_{AHP_C}(180)=125 and for the rest values of K\mathbb{K} , colAHPC(k)col_{AHP_C}(k) returns arbitrary elements of H\mathbb{H}, for example colAHPC(132)=135col_{AHP_C}(132)=135 and colAHPC(133)=1col_{AHP_C}(133)=1. Therefore colAHPC(x)=i=16yiLi(x)=162x5+62x4+161x3+169x2+88x+124col_{AHP_C}(x)=\sum_{i=1}^{6}y_iL_i(x)=162x^5+62x^4+161x^3+169x^2+88x+124.

and , valAHPC:K=val_{AHP_C}:\mathbb{K}= { 1,49,48,180,132,1331,49,48,180,132,133 } H=\to\mathbb{H}= { 1,59,42,125,1351,59,42,125,135 } so that valAHPC(1)=1(5rowAHPC4(1))(5colAHPC4(1))=15×424×5×424=127114(mod181)val_{AHP_C}(1)=\frac{1}{(5row_{AHP_C}^4(1))(5col_{AHP_C}^4(1))}=\frac{1}{5\times 42^4\times5\times42^4}=\frac{1}{27}\equiv 114\hspace{1mm}(\textrm{mod}\hspace{1mm}181), valAHPC(49)=1(5rowAHPC4(49))(5colAHPC4(49))=15×1254×5×1254=111782(mod181)val_{AHP_C}(49)=\frac{1}{(5row_{AHP_C}^4(49))(5col_{AHP_C}^4(49))}=\frac{1}{5\times 125^4\times5\times125^4}=\frac{1}{117}\equiv 82\hspace{1mm}(\textrm{mod}\hspace{1mm}181) , valAHPC(48)=1(5rowAHPC4(48))(5colAHPC4(48))=15×1354×5×1354=11455(mod181)val_{AHP_C}(48)=\frac{1}{(5row_{AHP_C}^4(48))(5col_{AHP_C}^4(48))}=\frac{1}{5\times 135^4\times5\times135 ^4}=\frac{1}{145}\equiv 5\hspace{1mm}(\textrm{mod}\hspace{1mm}181) and valAHPC(k)=0val_{AHP_C}(k)=0 for kK{1,49,48}k\in \mathbb{K}-\{1,49,48\}. Therefore valAHPC(x)=i=16yiLi(x)=65x5+61x4+157x3+53x2+16x+124val_{AHP_C}(x)=\sum_{i=1}^{6}y_iL_i(x)=65x^5+61x^4+157x^3+53x^2+16x+124.

Now, rowAHPC^\hat{row_{AHP_C}}, colAHPC^\hat{col_{AHP_C}} and valAHPC^\hat{val_{AHP_C}} are extensions of rowAHPCrow_{AHP_C}, colAHPCcol_{AHP_C} and valAHPCval_{AHP_C} so that are agree on K\mathbb{K}.

Therefore, OAHP=(124,88,169,161,62,162,14,169,109,32,150,128,84,180,111,22,79,\overrightarrow{O}_{AHP}=(124,88,169,161,62,162,14,169,109,32,150,128,84,180,111,22,79, 72,124,168,151,37,85,20,0,164,18,180,164,18,75,176,55,34,53,86,124,88,169,72,124,168,151,37,85,20,0,164,18,180,164,18,75,176,55,34,53,86,124,88,169, 161,62,162,124,88,169,161,62,162,124,16,53,157,61,65)161,62,162,124,88,169,161,62,162,124,16,53,157,61,65).

3- The Prover calculates commitment by using of KZGKZG commitment scheme as following:

ComT=i=0degTaigτi=i=0degTaick(i)Com_{T}=\sum_{i=0}^{deg_T}a_ig\tau^i=\sum_{i=0}^{deg_T}a_ick(i) where aia_i is coefficient of xix^i in polynomial T(x)T(x).

4- The Prover sends

ComAHP0=i=05rowAHPAi^ck(i)=124ck(0)+88ck(1)+169ck(2)+161ck(3)+62ck(4)+162ck(5)166(mod181)Com_{AHP}^0=\sum_{i=0}^{5}\hat{row_{AHP_{A_i}}}\hspace{1.1mm}ck(i)=124ck(0)+88ck(1)+169ck(2)+161ck(3)+62ck(4)+162ck(5) \equiv 166\hspace{1mm}(\textrm{mod}\hspace{1mm} 181)

and similarly

ComAHP1=36Com_{AHP}^1=36, ComAHP2=108Com_{AHP}^2=108, ComAHP3=58Com_{AHP}^3=58, ComAHP4=73Com_{AHP}^4=73, ComAHP5=157Com_{AHP}^5=157, ComAHP6=166Com_{AHP}^6=166, ComAHP7=166Com_{AHP}^7=166 and ComAHP8=36Com_{AHP}^8=36.

AHP Commitment JSON File Example 1

IoT_Manufacturer_Name = "zkIoT" IoT_Device_Name = "MultiSensor" Device_Hardware_Version = "1.0" Firmware_Version = "1.0" Device Picture= <> Lines = [200, 350, 4000-4010]

{
    "commitmentId": String,
    "deviceType": String,
    "deviceIdType": String,
    "deviceModel": String,
    "manufacturer": String,
    "softwareVersion": String,
    "class": 32-bit Integer,
    "m": 6,
    "n": 5,
    "p": 181,
    "g": 2,   
        
    // PFR Commitment   
    "row_PFR_A": 64-bit Array,
    "col_PFR_A": 64-bit Array,
    "val_PFR_A": 64-bit Array,
    "row_PFR_B": 64-bit Array,
    "col_PFR_B": 64-bit Array,
    "val_PFR_B": 64-bit Array,
    "row_PFR_C": 64-bit Array,
    "col_PFR_C": 64-bit Array,
    "val_PFR_C": 64-bit Array,
    
    "Com_PFR0": 64-bit Integer,
    "Com_PFR1": 64-bit Integer,
    "Com_PFR2": 64-bit Integer,
    "Com_PFR3": 64-bit Integer,
    "Com_PFR4": 64-bit Integer,
    "Com_PFR5": 64-bit Integer,
    "Com_PFR6": 64-bit Integer,
    "Com_PFR7": 64-bit Integer,
    "Com_PFR8": 64-bit Integer,   

    // AHP Commitment       
    "row_AHP_A":[124,88,169,161,62,162],
    "col_AHP_A":[14,169,109,32,150,128],
    "val_AHP_A":[84,180,111,22,79,72],
    "row_AHP_B":[124,168,151,37,85,20],
    "col_AHP_B":[0,164,18,180,164,18],
    "val_AHP_B":[75,176,55,34,53,86],
    "row_AHP_C":[124,88,169,161,62,162],
    "col_AHP_C":[124,88,169,161,62,162],
    "val_AHP_C":[124,16,53,157,61,65],
    
    "Com_AHP0":166,
    "Com_AHP1":36,
    "Com_AHP2":108,
    "Com_AHP3":58,
    "Com_AHP4":73,
    "Com_AHP5":157,
    "Com_AHP6":166,
    "Com_AHP7":166,
    "Com_AHP8":36,
    
    "curve": "bn128",
    "PolynomialCommitment": "KZG"
}

Last updated