docs
  • README
  • Browsing the Fides Innova ZKP Network
  • Connecting Your MetaMask to the Network
  • Full Node
  • Introduction
  • Mobile App
  • Publishing Service Contracts on the Fides Innova Blockchain
  • Web App (User Panel, Admin Panel)
  • Fides Zero-Knowledge Proof (ZKP) Algorithm
    • 1- Setup Phase
      • 1- Setup Phase
      • Example 1
      • Example 2
    • 2-commitment-phase
      • 2- Commitment Phase
      • Example 1
      • Example 2
    • 3- Proof Generation Phase
      • 3- Proof Generation Phase
      • Example 1
      • Example 2
    • 4- Proof Verification Phase
      • 4- Proof Verification Phase
      • Example 1
      • Example 2
    • 5-target-architecture
      • Target architecture - RISC-V RV32IM
      • Target architecture - ARMv6-M Cortex-M0 32-bit ARM - RaspberryPi Pico
      • Target architecture - Cortex-A53 - for Siemens SIMATIC IOT2050
  • Tech Stack
    • Message Queuing Telemetry Transport (MQTT) protocol
    • Service Contract
    • Service Market
    • ZKP-enabled JavaScript Execution
  • ZKP and IoT Device Firmware Integration (zk-Device Design)
    • E-Card; a sample zk-Device
      • Installation
      • Instruction Set Architecture (ISA)
      • Mesh IoT Network
      • Reset
Powered by GitBook
On this page
  • PFR Verify
  • AHP Verify
  1. Fides Zero-Knowledge Proof (ZKP) Algorithm
  2. 4- Proof Verification Phase

Example 1

Previous4- Proof Verification PhaseNextExample 2

Last updated 2 months ago

PFR Verify

Verify(F,H,K,comPFR,πPFR)Verify(\mathbb{F}, \mathbb{H}, \mathbb{K}, com_{PFR},\pi_{PFR})Verify(F,H,K,comPFR​,πPFR​):

1)1)1) The Verifier checks h(γp1)=h(γ0)=a1=ω2h(\gamma^{p_1})=h(\gamma^0)=a_1=\omega^2h(γp1​)=h(γ0)=a1​=ω2 and h(γp2)=h(γ3)=a2=0h(\gamma^{p_2})=h(\gamma^3)=a_2=0h(γp2​)=h(γ3)=a2​=0. Here, the Verifier checks h(1)=42h(1)=42h(1)=42 and h(48)=0h(48)=0h(48)=0.

2)2)2) M(β2)−q2(β2)ZK(β2)=0M(\beta_2)-q_2(\beta_2)Z_{\mathbb{K}}(\beta_2)=0M(β2​)−q2​(β2​)ZK​(β2​)=0 , that means 36−30×146=36−36≡0(mod181)36-30\times 146=36-36\equiv 0\hspace{1mm}(\textrm{mod}\hspace{1mm}181)36−30×146=36−36≡0(mod181), and F′(β1)−q1(β1)ZK(β1)=0F'(\beta_1)-q_1(\beta_1)Z_{\mathbb{K}}(\beta_1)=0F′(β1​)−q1​(β1​)ZK​(β1​)=0, that means 0−86×0≡0(mod181)0-86\times 0\equiv 0\hspace{1mm}(\textrm{mod}\hspace{1mm}181)0−86×0≡0(mod181).

AHP Verify

Verify(F181,H,K,ComAHP,ΠAHP,x=4,y=82)Verify(\mathbb{F}_{181}, \mathbb{H}, \mathbb{K}, Com_{AHP},\Pi_{AHP},x=4,y=82)Verify(F181​,H,K,ComAHP​,ΠAHP​,x=4,y=82) :

Since h3(β3)=h3(5)=h_3(\beta_3)=h_3(5)=h3​(β3​)=h3​(5)= and vK(β3)=vK(5)=134v_{\mathbb{K}}(\beta_3)=v_{\mathbb{K}}(5)=134vK​(β3​)=vK​(5)=134, therefore, the left of equation (1)(1)(1) is h3(β3)vK(β3)=160h_3(\beta_3)v_{\mathbb{K}}(\beta_3)=160h3​(β3​)vK​(β3​)=160 . Also, since a(β3)=a(5)=a(\beta_3)=a(5)=a(β3​)=a(5)=, b(β3)=b(5)=b(\beta_3)=b(5)=b(β3​)=b(5)= and β3g3(β3)+σ3∣K∣=\beta_3g_3(\beta_3)+\frac{\sigma_3}{|\mathbb{K}|}=β3​g3​(β3​)+∣K∣σ3​​=, therefore, the right of the equation (1)(1)(1) is a(β3)−b(β3)(σ3g3(β3)+σ3∣K∣)=160a(\beta_3)-b(\beta_3)(\sigma_3g_3(\beta_3)+\frac{\sigma_3}{|\mathbb{K}|})=160a(β3​)−b(β3​)(σ3​g3​(β3​)+∣K∣σ3​​)=160. So, the equation (1)(1)(1) is established.

Since r(α,β2)=α5−β25α−β2=105−80510−80=142r(\alpha,\beta_2)=\frac{\alpha^5-\beta_2^5}{\alpha-\beta_2}=\frac{10^5-80^5}{10-80}=142r(α,β2​)=α−β2​α5−β25​​=10−80105−805​=142, σ3=84\sigma_3=84σ3​=84, therefore, the left of equation (2)(2)(2) is r(α,β2)σ3=163r(\alpha,\beta_2)\sigma_3=163r(α,β2​)σ3​=163 and since h2(β2)=h2(80)=42h_2(\beta_2)=h_2(80)=42h2​(β2​)=h2​(80)=42, vH(β2)=vH(80)=72v_{\mathbb{H}}(\beta_2)=v_{\mathbb{H}}(80)=72vH​(β2​)=vH​(80)=72, β2g2(β2)+σ2∣H∣=35\beta_2g_2(\beta_2)+\frac{\sigma_2}{|\mathbb{H}|}=35β2​g2​(β2​)+∣H∣σ2​​=35, therefore, the right of equation (2)(2)(2) is h2(β2)vH+β2g2(β2)+σ2∣H∣=163h_2(\beta_2)v_{\mathbb{H}}+\beta_2g_2(\beta_2)+\frac{\sigma_2}{|\mathbb{H}|}=163h2​(β2​)vH​+β2​g2​(β2​)+∣H∣σ2​​=163. So, equation (2)(2)(2) is established.

Since s(β1)=s(22)=138s(\beta_1)=s(22)=138s(β1​)=s(22)=138, r(α,β1)=130r(\alpha,\beta_1)=130r(α,β1​)=130, ∑M∈{A,B,C}ηMz^M(β1)=121\sum_{M\in\{A,B,C\}}\eta_M\hat{z}_M(\beta_1)=121∑M∈{A,B,C}​ηM​z^M​(β1​)=121, z^(β1)=53\hat{z}(\beta_1)=53z^(β1​)=53, σ2=70\sigma_2=70σ2​=70, therefore, the left of the equation (3)(3)(3) is s(β1)+r(α,β1)(∑M∈{A,B,C}ηMz^M(β1))−σ2z^(β1)=31s(\beta_1)+r(\alpha,\beta_1)(\sum_{M\in\{A,B,C\}}\eta_M\hat{z}_M(\beta_1))-\sigma_2\hat{z}(\beta_1)=31s(β1​)+r(α,β1​)(∑M∈{A,B,C}​ηM​z^M​(β1​))−σ2​z^(β1​)=31. Also since h1(β1)=h1(22)=94h_1(\beta_1)=h_1(22)=94h1​(β1​)=h1​(22)=94, vH(β1)=vH(22)=18v_{\mathbb{H}}(\beta_1)=v_{\mathbb{H}}(22)=18vH​(β1​)=vH​(22)=18, g1(β1)=g1(22)=100g_1(\beta_1)=g_1(22)=100g1​(β1​)=g1​(22)=100, σ1=62\sigma_1=62σ1​=62, therefore the right of the equation (3)(3)(3) is h1(β1)vH(β1)+β1g1(β1)+σ1∣H∣=31h_1(\beta_1)v_{\mathbb{H}}(\beta_1)+\beta_1g_1(\beta_1)+\frac{\sigma_1}{|\mathbb{H}|}=31h1​(β1​)vH​(β1​)+β1​g1​(β1​)+∣H∣σ1​​=31. So, the equation (3)(3)(3) is established.

Since z^A(β1)=z^A(22)=140\hat{z}_A(\beta_1)=\hat{z}_A(22)=140z^A​(β1​)=z^A​(22)=140, z^B(β1)=z^B(22)=115\hat{z}_B(\beta_1)=\hat{z}_B(22)=115z^B​(β1​)=z^B​(22)=115, z^C(β1)=z^C(22)=125\hat{z}_C(\beta_1)=\hat{z}_C(22)=125z^C​(β1​)=z^C​(22)=125, therefore, the left of the equation (4)(4)(4) is z^A(β1)z^B(β1)−z^C(β1)=47\hat{z}_A(\beta_1)\hat{z}_B(\beta_1)-\hat{z}_C(\beta_1)=47z^A​(β1​)z^B​(β1​)−z^C​(β1​)=47. Also since h0(β1)=h0(22)=73h_0(\beta_1)=h_0(22)=73h0​(β1​)=h0​(22)=73 and vH(β1)=vH(22)=18v_{\mathbb{H}}(\beta_1)=v_{\mathbb{H}}(22)=18vH​(β1​)=vH​(22)=18, therefore the right of the equation (4)(4)(4) is h0(β1)vH(β1)=47h_0(\beta_1)v_{\mathbb{H}}(\beta_1)=47h0​(β1​)vH​(β1​)=47. So the equation (4)(4)(4) is established.

2- The output resultresultresult in following steps is 111.

2-1- The Verifier chooses random values ηw^\eta_{\hat{w}}ηw^​, ηz^A\eta_{\hat{z}_A}ηz^A​​, ηz^B\eta_{\hat{z}_B}ηz^B​​, ηz^C\eta_{\hat{z}_C}ηz^C​​, ηh0\eta_{h_0}ηh0​​, ηs\eta_sηs​, ηg1\eta_{g_1}ηg1​​, ηh1\eta_{h_1}ηh1​​, ηg2\eta_{g_2}ηg2​​, ηh2\eta_{h_2}ηh2​​, ηg3\eta_{g_3}ηg3​​ and ηh3\eta_{h_3}ηh3​​ of F\mathbb{F}F For example, ηw^=1\eta_{\hat{w}}=1ηw^​=1, ηz^A=4\eta_{\hat{z}_A}=4ηz^A​​=4, ηz^B=10\eta_{\hat{z}_B}=10ηz^B​​=10, ηz^C=8\eta_{\hat{z}_C}=8ηz^C​​=8, ηh0=32\eta_{h_0}=32ηh0​​=32, ηs=45\eta_s=45ηs​=45, ηg1=92\eta_{g_1}=92ηg1​​=92, ηh1=11\eta_{h_1}=11ηh1​​=11, ηg2=1\eta_{g_2}=1ηg2​​=1, ηh2=5\eta_{h_2}=5ηh2​​=5, ηg3=25\eta_{g_3}=25ηg3​​=25 and ηh3=63\eta_{h_3}=63ηh3​​=63.

2-2- The Verifier derives commitment of p(x)p(x)p(x), CompCom_pComp​, by using polynomial commitment scheme homomorphism. For example, if polynomial commitment scheme KZGKZGKZG is used, then Comp=ηw^ComAHPX2+ηz^AComAHPX3+ηz^BComAHPX4+ηz^CComAHPX5+ηh0ComAHPX6+ηsComAHPX7+ηg1ComAHPX8+ηh1ComAHPX9+ηg2ComAHPX10+ηh2ComAHPX11+ηg3ComAHPX12+ηh3ComAHPX13=114Com_p=\eta_{\hat{w}}Com_{AHP_X}^2+\eta_{\hat{z}_A}Com_{AHP_X}^3+\eta_{\hat{z}_B}Com_{AHP_X}^4+\eta_{\hat{z}_C}Com_{AHP_X}^5+\eta_{h_0}Com_{AHP_X}^6+\eta_sCom_{AHP_X}^7+\eta_{g_1}Com_{AHP_X}^8+\eta_{h_1}Com_{AHP_X}^9+\eta_{g_2}Com_{AHP_X}^{10}+\eta_{h_2}Com_{AHP_X}^{11}+\eta_{g_3}Com_{AHP_X}^{12}+\eta_{h_3}Com_{AHP_X}^{13}=114Comp​=ηw^​ComAHPX​2​+ηz^A​​ComAHPX​3​+ηz^B​​ComAHPX​4​+ηz^C​​ComAHPX​5​+ηh0​​ComAHPX​6​+ηs​ComAHPX​7​+ηg1​​ComAHPX​8​+ηh1​​ComAHPX​9​+ηg2​​ComAHPX​10​+ηh2​​ComAHPX​11​+ηg3​​ComAHPX​12​+ηh3​​ComAHPX​13​=114

2-3- The Verifier chooses random x′∈Fx'\in\mathbb{F}x′∈F and queries p(x′)p(x')p(x′). For example, x′=2x'=2x′=2.

2-4- The Verifier computes result=PC.Check(vk,Comp,x′,y′=πAHP16,πAHP17)result=PC.Check(vk,Com_p,x',y'=\pi_{AHP}^{16},\pi_{AHP}^{17})result=PC.Check(vk,Comp​,x′,y′=πAHP16​,πAHP17​). For example, if polynomial commitment scheme KZGKZGKZG is used, then the following equation checks: e(Comp−gy′,g)=e(πAHP17,vk−gx′)e(Com_p-gy',g)=e(\pi_{AHP}^{17},vk-gx')e(Comp​−gy′,g)=e(πAHP17​,vk−gx′)

where e(Comp−gy′,g)=e(114−2×119,2)=e(57,2)=e(2×119,2)=119e(2,2)=119×3=176e(Com_p-gy',g)=e(114-2\times 119,2)=e(57,2)=e(2\times 119,2)=119e(2,2)=119\times3=176e(Comp​−gy′,g)=e(114−2×119,2)=e(57,2)=e(2×119,2)=119e(2,2)=119×3=176 and e(πAHP17,vk−gx′)=e(149,57−2×2)=e(2×165,2×117)=119e(2,2)=119×3=176e(\pi_{AHP}^{17},vk-gx')=e(149,57-2\times 2)=e(2\times 165,2\times 117)=119e(2,2)=119\times 3=176e(πAHP17​,vk−gx′)=e(149,57−2×2)=e(2×165,2×117)=119e(2,2)=119×3=176