File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -93,15 +93,16 @@ snarkjs verify --verificationkey verification_key.json --proof proof.json --publ
93
93
```
94
94
可以看到invalid.
95
95
96
- ### 链上证明
96
+ ### 链上证明(Proving on-chain)
97
97
98
- - 生成 Solidity 的证明
98
+ - 生成 Solidity 的证明合约
99
99
100
100
``` sh
101
101
snarkjs generateverifier --verificationkey verification_key.json --verifier verifier.sol
102
102
```
103
+ 会有Pairings and Verifier 两个合约,关注Verifier即可。
103
104
104
- - 发布证明
105
+ - 发布证明
105
106
可以复制 verifier.sol 代码到 remix 进行部署
106
107
107
108
- 生成调用的参数
@@ -110,14 +111,22 @@ snarkjs generateverifier --verificationkey verification_key.json --verifier veri
110
111
snarkjs generatecall --proof proof.json --public public.json
111
112
```
112
113
113
- - 进行调用
114
+ - 进行合约调用
114
115
将命令的输出复制到 Remix 中的 verifyProof 方法的 parameters 字段中,点击 call 调用 verifyProof
115
116
如果一切正常,方法应该返回 true
116
117
如果仅更改参数中的任何位,则可以检查结果返回 false
117
118
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 <--.
118
126
## 参考资料
119
127
120
128
- 创建第一个零知识 snark 电路: https://learnblockchain.cn/article/1078
129
+ - 参考文档:https://blog.iden3.io/first-zk-proof.html
121
130
- circom2 doc: https://docs.circom.io/circom-language/basic-operators/
122
131
- snarkjs: https://github.com/iden3/snarkjs
123
132
- 深入浅出零知识证明之zk-SNARKs: https://www.yuque.com/u428635/scg32w/edmn74
You can’t perform that action at this time.
0 commit comments