当前位置:网站首页>使用 Zokrates 在 BSV 上创建您的第一个 zkSNARK 证明
使用 Zokrates 在 BSV 上创建您的第一个 zkSNARK 证明
2022-08-01 21:48:00 【sCrypt 智能合约】
这个 ZoKratesFork库 是 BSV 上 zkSNARKs 的工具箱。它可以帮助您在应用程序中使用可验证的计算,从高级语言的编写的电路到生成计算证明,再到在 sCrypt 中验证这些证明。
安装
下载并使用我们发布的二进制包:
https://github.com/sCrypt-Inc/zokrates/releases/latest
或者从源码编译:
git clone https://github.com/sCrypt/ZoKrates
./build_release.sh
cd target/release
工作流程
整个工作流程与原始 ZoKrates 相同,除了验证部分。
- 编写电路程序,创建文本文件
root.zok并实现以下的程序。在这个例子中,我们将证明知道数字b的平方根为a:
def main(private field a, field b) {
assert(a * a == b);
return;
}
- 编译电路
zokrates compile -i root.zok
- 执行设置
zokrates setup
- 计算见证人
zokrates compute-witness -a 337 113569
- 生成证明
zokrates generate-proof
- 导出验证者智能合约
verifier.scrypt, 同时会提供一个verifier.js文件
zokrates export-verifier-scrypt
- 执行
verifier.js验证 zkSNARK 证明1。如果本地验证成功,则会将verifier.scrypt验证者合约部署到测试网2,并调用部署的验证者合约
node --max-old-space-size=8192 verifier.js
[1] 在此之前,你需要确保安装了
scryptlib和axiosnodejs 模块。 由于验证者合约较大,增加--max-old-space-size=8192确保 nodejs 内存充足[2] 需要填写测试网私钥
边栏推荐
- 统计单词数
- Image fusion GANMcC study notes
- Analysis of the development trend of game metaverse
- 如何优雅的性能调优,分享一线大佬性能调优的心路历程
- Dichotomy Medium LeetCode6133. Maximum Number of Groups
- 高等代数_证明_矩阵的行列式为特征值之积, 矩阵的迹为特征值之和
- ImportError: `save_weights` requires h5py.问题解决
- Based on php online music website management system acquisition (php graduation design)
- scikit-learn no moudule named six
- 数字图像处理 第十二章——目标识别
猜你喜欢
随机推荐
Spark shuffle调优
51.【结构体初始化的两种方法】
Based on php online learning platform management system acquisition (php graduation design)
【建议收藏】ヾ(^▽^*)))全网最全输入输出格式符整理
MySQL相关知识
Flink cluster construction
WEB 渗透之文件类操作
如何防范 DAO 中的治理攻击?
SOM Network 2: Implementation of the Code
Based on php film and television information website management system acquisition (php graduation design)
Recycling rental system 100% open source without encryption Mall + recycling + rental
19 Lectures on Disassembly of Multi-merchant Mall System Functions - Invoice Management on the Platform
LeetCode952三部曲之二:小幅度优化(137ms -> 122ms,超39% -> 超51%)
LeetCode952三部曲之一:解题思路和初级解法(137ms,超39%)
安全第五次课后练习
leetcode 204. Count Primes 计数质数 (Easy)
入门数据库Days4
数据分析面试手册《指标篇》
Advanced Algebra_Proof_The algebraic multiplicity of any eigenvalue of a matrix is greater than or equal to its geometric multiplicity
Raspberry Pi information display small screen, display time, IP address, CPU information, memory information (C language), four-wire i2c communication, 0.96-inch oled screen









