Skip to content

Commit 2ca21de

Browse files
committed
fix the task22
1 parent f717c1f commit 2ca21de

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

basic/22-zk-snarkjs/readme.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,16 @@ snarkjs verify --verificationkey verification_key.json --proof proof.json --publ
9393
```
9494
可以看到invalid.
9595

96-
### 链上证明
96+
### 链上证明(Proving on-chain)
9797

98-
- 生成 Solidity 的证明
98+
- 生成 Solidity 的证明合约
9999

100100
```sh
101101
snarkjs generateverifier --verificationkey verification_key.json --verifier verifier.sol
102102
```
103+
会有Pairings and Verifier 两个合约,关注Verifier即可。
103104

104-
- 发布证明
105+
- 发布证明
105106
可以复制 verifier.sol 代码到 remix 进行部署
106107

107108
- 生成调用的参数
@@ -110,14 +111,22 @@ snarkjs generateverifier --verificationkey verification_key.json --verifier veri
110111
snarkjs generatecall --proof proof.json --public public.json
111112
```
112113

113-
- 进行调用
114+
- 进行合约调用
114115
将命令的输出复制到 Remix 中的 verifyProof 方法的 parameters 字段中,点击 call 调用 verifyProof
115116
如果一切正常,方法应该返回 true
116117
如果仅更改参数中的任何位,则可以检查结果返回 false
117118

119+
120+
121+
122+
## circom语法
123+
1. <-- assigns a value to a signal without adding a constraint.
124+
2. Whereas === adds a constraint without assigning a value.
125+
3. <== both assigns a value to a signal and adds a contraint。Which means it’s just the combination of === and <--.
118126
## 参考资料
119127

120128
- 创建第一个零知识 snark 电路: https://learnblockchain.cn/article/1078
129+
- 参考文档:https://blog.iden3.io/first-zk-proof.html
121130
- circom2 doc: https://docs.circom.io/circom-language/basic-operators/
122131
- snarkjs: https://github.com/iden3/snarkjs
123132
- 深入浅出零知识证明之zk-SNARKs: https://www.yuque.com/u428635/scg32w/edmn74

0 commit comments

Comments
 (0)