Efficient Zero-Knowledge Argument for Correctness of a Shuffle学习笔记(3)

1. 前言

在本博客中,主要介绍对Stephanie Bayer和Jens Groth 2012年论文《Efficient Zero-Knowledge Argument for Correctness of a Shuffle》中各算法的代码实现。目前github上主要有两类实现:

  • https://github.com/derbear/verifiable-shuffle
  • https://github.com/nirvantyagi/stadium和https://github.com/grnet/bg-mixnet

2. https://github.com/derbear/verifiable-shuffle中代码实现

round_n,nn为奇数对应是Prover操作,nn为偶数对应是Verifier操作。

  • round_1:shuffle argument中的commit to π(1),,π(N)\pi(1),…,\pi(N)
  • round_2:challenge chal_x2chal\_x2
  • round_3:x=chal_x2x=chal\_x2, commit to xπ(1),,xπ(N)x^{\pi(1)},…,x^{\pi(N)}
  • round_4:challenge chal_y4,chal_z4chal\_y4,chal\_z4
  • round_5a: y=chal_y4,z=chal_z4y=chal\_y4,z=chal\_z4,构建矩阵D=(d1z=yπ(1)+xπ(1)z,,dNz=yπ(N)+xπ(N)z)=(d1,d2,,dm)D=(d_1-z=y\pi(1)+x^{\pi(1)}-z,…,d_N-z=y\pi(N)+x^{\pi(N)}-z)=(\vec{d}_1,\vec{d}_2,\cdots,\vec{d}_m),构建用于product argument的矩阵D_h=(d1,d1d2,,d1d2dm)=(dh1,dh2,,dhm1,dhm)D\_h=(\vec{d}_1,\vec{d}_1\cdot\vec{d}_2,\cdots,\vec{d}_1\cdot\vec{d}_2\cdots\vec{d}_m)=(\vec{d}_{h_1},\vec{d}_{h_2},\cdots,\vec{d}_{h_{m-1}},\vec{d}_{h_m}),并对D_hD\_h进行commit。
  • round_5b:引入随机变量B0ZqnB_0\leftarrow \mathbb{Z}_q^naZq2ma\leftarrow \mathbb{Z}_q^{2m}并分别对其commit,分别对应Multi-exponentiation Argument中的cA0{cBk}k=02m1c_{A_0}和\{c_{B_k}\}_{k=0}^{2m-1}
  • round_5c:计算Multi-exponentiation Argument中的{Ek}k=02m1\{E_{k}\}_{k=0}^{2m-1}
  • round_6:challenge chal_x6Zq2m:(x,x2,,x2m)chal_y6Zqn:(y,y2,,yn)chal\_x6\leftarrow\mathbb{Z}_q^{2m}:(x,x^2,\cdots,x^{2m})和chal\_y6\leftarrow\mathbb{Z}_q^{n}:(y,y^2,\cdots,y^{n})
  • round_7a:
    为Hadamard product argument服务,引入随机向量dm+1Zqn\vec{d}_{m+1}\leftarrow \mathbb{Z}_q^n,commitment to dm+1\vec{d}_{m+1},构建矩阵D_s=(xdh1,x2dh2,,xm1dhm1,i=1m1xidhi+1,dm+1)D\_s=(x\vec{d}_{h_1},x^2\vec{d}_{h_2},\cdots,x^{m-1}\vec{d}_{h_{m-1}},\sum_{i=1}^{m-1}{x^i\vec{d}_{h_{i+1}}},\vec{d}_{m+1}),commit to D_sD\_s
    为zero argument服务,构建相应的D_lD\_l并commit,对应其中的cDcA0cBm\vec{c}_D、c_{A_0}和c_{B_m}
    为Single value product argument服务,引入随机变量dZqn\vec{d}\leftarrow\mathbb{Z}_q^n,计算cdcδcΔc_d、c_{\delta}和c_{\Delta}
  • round_7b:计算Multi-exponentiation Argument中的a,r,b,s,τ\vec{a},r,b,s,\tau
  • round_8:challenge chal_x8Zq2m+1:(x,x2,,x2m+1)chal\_x8\leftarrow\mathbb{Z}_q^{2m+1}:(x,x^2,\cdots,x^{2m+1})
  • round_9a:计算Single value product argument中的a~1,,a~n,r~\tilde{a}_1,\cdots,\tilde{a}_n,\tilde{r}b~1,,b~n,s~\tilde{b}_1,\cdots,\tilde{b}_n,\tilde{s}
  • round_9b:计算zero argument中的a,b,r,s,t\vec{a},\vec{b},r,s,t
  • round_10:分别对shuffle argument、Multi-exponentiation Argument、Hadamard product argument、zero argument以及Single value product argument的最后一步verify即可。

3. https://github.com/nirvantyagi/stadium和https://github.com/grnet/bg-mixnet中代码实现

https://github.com/nirvantyagi/stadium和https://github.com/grnet/bg-mixnet两套代码之间的关系为:
bg-mixnet builds on top of the Stadium software project, which is hosted at https://github.com/nirvantyagi/stadium. Stadium is a distributed metadata-private messaging system.
Efficient Zero-Knowledge Argument for Correctness of a Shuffle学习笔记(3)
性能相对于https://github.com/derbear/verifiable-shuffle做了性能优化:
Efficient Zero-Knowledge Argument for Correctness of a Shuffle学习笔记(3)