Whisker17 / zkpThings

This repo contains kinds of zkp scheme in current market
40 stars 10 forks source link

从零开始学习 zk-SNARK #10

Open Whisker17 opened 3 years ago

Whisker17 commented 3 years ago

安比实验室翻译的 《Why and How zk-SNARK Works: Definitive Explanation》:

原文链接:Why and How zk-SNARK Works: Definitive Explanation

Whisker17 commented 3 years ago

Contents

Whisker17 commented 3 years ago

image

image

Whisker17 commented 3 years ago

image

代数的基本原理也告诉我们,对于一个阶数为 d 的多项式至多有 d 个解(以下部分将对此进行详细介绍),因而也就至多有d 个共同点

image

Whisker17 commented 3 years ago

多项式可以被因式分解成它的根的因式的乘积。这个性质就意味着,如果一个多项式有某些解,那么它被因式分解后的式子中一定包含这些解的因式

image

但是,这个结构中还存在好多问题:

image

Whisker17 commented 3 years ago

对此,我们引入了一种同态加密的模式,这种同态加密模式有一个限制,我们可以把一个加密的值和一个未加密的值相乘,但我们不能将两个加密的值相乘(或者相除),也就是说我们不能对加密值取幂。虽然这些性质第一感觉看起来很不友好,但是这却构成了 zk-SNARK 的基础。

Whisker17 commented 3 years ago

image

尽管这个协议中 prover 的灵活性有限,他依然可以在实际不使用 verifier 所提供的加密值进行计算,而是通过其它的方式来伪造证明。例如,如果 prover 声称有一个满足条件的多项式它只使用了 2 个求幂值 s3 和 s1,这个在当前协议中是不能验证的。

Whisker17 commented 3 years ago

KEA

image

image

Whisker17 commented 3 years ago

image

image

image

Whisker17 commented 3 years ago

反过来保护 Prover 不被 Verifier 提取相关信息

image

image

Whisker17 commented 3 years ago

非交互式

image

image

image

image

Whisker17 commented 3 years ago

image

image

Whisker17 commented 3 years ago

image

image

image

Whisker17 commented 3 years ago

多项式的SNARK

image

Whisker17 commented 3 years ago

image

image

Whisker17 commented 3 years ago

image

image

image

这里解决这样一个问题,算术电路中一个 input wire 或者 output wire可能同时会作为多个门的输入wire,如何确保约束这些公用wire的问题。

Whisker17 commented 3 years ago

可验证计算协议

image

Whisker17 commented 3 years ago

最终的 zk-SNARK 协议

image