基于Nova的MinRoot VDF实现

1. 引言

前序博客有:

代码见:

有多种类型的VDF算法:
在这里插入图片描述
同一类型的VDF,根据所选择的曲线不同,所使用的参数也有所不同:
在这里插入图片描述
https://github.com/Microsoft/Nova 中的MinRoot,所采用的为:
f ( x i + 1 , y i + 1 ) = ( ( x i + y i ) 1 / 5 , x i ) f(x_{i+1},y_{i+1})=((x_i+y_i)^{1/5}, x_i) f(xi+1,yi+1)=((xi+yi)1/5,xi)

详细代码见examples/minroot.rs

Nova-based VDF with MinRoot delay function
=========================================================
Proving 1024 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 73.078327592s 
Number of constraints per step (primary circuit): 12888
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 12882
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 4.624µs 
RecursiveSNARK::prove_step 1: true, took 1.166330261s 
RecursiveSNARK::prove_step 2: true, took 1.224084382s 
RecursiveSNARK::prove_step 3: true, took 1.275612276s 
RecursiveSNARK::prove_step 4: true, took 1.247531567s 
RecursiveSNARK::prove_step 5: true, took 1.276658484s 
RecursiveSNARK::prove_step 6: true, took 1.233760567s 
RecursiveSNARK::prove_step 7: true, took 1.230236579s 
RecursiveSNARK::prove_step 8: true, took 1.24617902s 
RecursiveSNARK::prove_step 9: true, took 1.202719954s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 381.332458ms
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 33.365056086s
CompressedSNARK::len 9403 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 388.515267ms
=========================================================
Proving 2048 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 70.355994544s 
Number of constraints per step (primary circuit): 15960
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 15954
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 4.213µs 
RecursiveSNARK::prove_step 1: true, took 1.163035595s 
RecursiveSNARK::prove_step 2: true, took 1.211507467s 
RecursiveSNARK::prove_step 3: true, took 1.228544979s 
RecursiveSNARK::prove_step 4: true, took 1.218547311s 
RecursiveSNARK::prove_step 5: true, took 1.221717836s 
RecursiveSNARK::prove_step 6: true, took 1.218962179s 
RecursiveSNARK::prove_step 7: true, took 1.230055614s 
RecursiveSNARK::prove_step 8: true, took 1.218389455s 
RecursiveSNARK::prove_step 9: true, took 1.220260741s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 327.467486ms
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 28.405642566s
CompressedSNARK::len 9404 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 338.551301ms
=========================================================
Proving 4096 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 70.092380898s 
Number of constraints per step (primary circuit): 22104
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 22098
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 4.543µs 
RecursiveSNARK::prove_step 1: true, took 1.262449816s 
RecursiveSNARK::prove_step 2: true, took 1.30737881s 
RecursiveSNARK::prove_step 3: true, took 1.315299705s 
RecursiveSNARK::prove_step 4: true, took 1.298120798s 
RecursiveSNARK::prove_step 5: true, took 1.293002033s 
RecursiveSNARK::prove_step 6: true, took 1.296309126s 
RecursiveSNARK::prove_step 7: true, took 1.304054547s 
RecursiveSNARK::prove_step 8: true, took 1.290177872s 
RecursiveSNARK::prove_step 9: true, took 1.291139605s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 371.391454ms
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 42.00665964s
CompressedSNARK::len 9704 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 456.396603ms
=========================================================
Proving 8192 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 73.216632509s 
Number of constraints per step (primary circuit): 34392
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 34386
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 3.449µs 
RecursiveSNARK::prove_step 1: true, took 1.539035436s 
RecursiveSNARK::prove_step 2: true, took 1.622303693s 
RecursiveSNARK::prove_step 3: true, took 1.534060709s 
RecursiveSNARK::prove_step 4: true, took 1.500765389s 
RecursiveSNARK::prove_step 5: true, took 1.541102208s 
RecursiveSNARK::prove_step 6: true, took 1.521414059s 
RecursiveSNARK::prove_step 7: true, took 1.498017567s 
RecursiveSNARK::prove_step 8: true, took 1.507547714s 
RecursiveSNARK::prove_step 9: true, took 1.654619421s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 608.025166ms
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 73.425426802s
CompressedSNARK::len 10001 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 694.724361ms
=========================================================
Proving 16384 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 105.921985131s 
Number of constraints per step (primary circuit): 58968
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 58962
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 25.76µs 
RecursiveSNARK::prove_step 1: true, took 1.813137744s 
RecursiveSNARK::prove_step 2: true, took 1.878074321s 
RecursiveSNARK::prove_step 3: true, took 1.80861029s 
RecursiveSNARK::prove_step 4: true, took 2.396045213s 
RecursiveSNARK::prove_step 5: true, took 1.729798055s 
RecursiveSNARK::prove_step 6: true, took 1.729107037s 
RecursiveSNARK::prove_step 7: true, took 1.720501846s 
RecursiveSNARK::prove_step 8: true, took 1.743876552s 
RecursiveSNARK::prove_step 9: true, took 1.737904666s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 711.567199ms
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 78.038337919s
CompressedSNARK::len 9998 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 668.522336ms
=========================================================
Proving 32768 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 107.353152111s 
Number of constraints per step (primary circuit): 108120
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 108114
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 4.849µs 
RecursiveSNARK::prove_step 1: true, took 2.265852376s 
RecursiveSNARK::prove_step 2: true, took 2.2747954s 
RecursiveSNARK::prove_step 3: true, took 2.281599611s 
RecursiveSNARK::prove_step 4: true, took 2.306338036s 
RecursiveSNARK::prove_step 5: true, took 2.320080158s 
RecursiveSNARK::prove_step 6: true, took 2.281631356s 
RecursiveSNARK::prove_step 7: true, took 2.297964832s 
RecursiveSNARK::prove_step 8: true, took 2.281593708s 
RecursiveSNARK::prove_step 9: true, took 2.410508168s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 1.256136737s
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 138.11442845s
CompressedSNARK::len 10296 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 1.098852882s
=========================================================
Proving 65535 iterations of MinRoot per step
Producing public parameters...
PublicParams::setup, took 191.407999313s 
Number of constraints per step (primary circuit): 206421
Number of constraints per step (secondary circuit): 10347
Number of variables per step (primary circuit): 206415
Number of variables per step (secondary circuit): 10329
Generating a RecursiveSNARK...
RecursiveSNARK::prove_step 0: true, took 17.903µs 
RecursiveSNARK::prove_step 1: true, took 3.626168253s 
RecursiveSNARK::prove_step 2: true, took 3.637881318s 
RecursiveSNARK::prove_step 3: true, took 3.746542026s 
RecursiveSNARK::prove_step 4: true, took 3.559443813s 
RecursiveSNARK::prove_step 5: true, took 3.556236556s 
RecursiveSNARK::prove_step 6: true, took 3.591468574s 
RecursiveSNARK::prove_step 7: true, took 3.784589713s 
RecursiveSNARK::prove_step 8: true, took 3.766741089s 
RecursiveSNARK::prove_step 9: true, took 3.712172217s 
Verifying a RecursiveSNARK...
RecursiveSNARK::verify: true, took 2.256590247s
Generating a CompressedSNARK using Spartan with IPA-PC...
CompressedSNARK::prove: true, took 262.484895111s
CompressedSNARK::len 10590 bytes
Verifying a CompressedSNARK...
CompressedSNARK::verify: true, took 1.846402449s
=========================================================

参考资料

[1] Origami: Fold a Plonk for Ethereum’s VDF
[2] MinRoot: Candidate Sequential Function for Ethereum VDF
[3] VDF Proving with SnarkPack

Nova系列博客

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值