WebGPU+ZKP:客户端证明

1. 引言

Geometry团队近日发布了一个bounty(1500美金)项目:

希望借助WebGPU技术,实现在客户端的ZKP证明。

现有的一些WebGPU基础算法库有:

本次bounty项目重点关注但不限于以下维度:

  • 1)高层算法:
    • Multi-scalar multiplication(MSM)
    • 快速傅里叶变换(FFT)
  • 2)高效椭圆曲线运算:
    • 如曲线加法、指数幂运算等。
  • 3)高效有限域运算:
    • 如Poseidon哈希函数中高频使用的 x 5 m o d    p x^5\mod p x5modp运算,或MiMC7哈希函数中高频使用的 x 7 m o d    p x^7\mod p x7modp运算。
  • 4)任意常用哈希函数:
    • 如Poseidon 2、Reinforced Concrete、Tip5 或 MiMC等。

Rust提供了wgpu库,可实现CLI方式来运行WGSL代码。

2. 何为WebGPU?

WebGPU详细背景知识见:

3. wgsl-poseidon示例

https://github.com/geometryresearch/wgsl-poseidon(Rust+TypeScript+WGSL):基于BN254 Scalar域以WGSL实现了Poseidon哈希函数,可在浏览器内和命令行运行。
命令行运行:

running 1 test
Computing 16384 Poseidon hashes in Rust / WebGPU
CPU took 3388ms
AdapterInfo { name: "NVIDIA GeForce RTX 2060", vendor: 4318, device: 7944, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "516.94", backend: Vulkan }
GPU took 28ms
test poseidon::test_poseidon ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out; finished in 15.27s

浏览器内运行:

Computing 16384 Poseidon hashes in the browser / WebGPU
CPU took 829 ms
GPU took 49 ms

在这里插入图片描述
https://github.com/geometryresearch/wgsl-poseidon中关键参数为:

  • 输入长度(即rate)为 1
  • Poseidon inner state长度为 t = 2 t = 2 t=2,即对应capacity为1。
  • R f = 8 R_f=8 Rf=8
  • R p = 56 R_p=56 Rp=56

参考资料

[1] Geometry团队2023年7月博客 Geometry Bounty: WebGPU for ZK Proving

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值