当前位置:网站首页>Technology: how to design zkvm circuit
Technology: how to design zkvm circuit
2022-06-29 03:53:00 【chinadefi】
technology : How to design zkVM circuit


Custom doors
In the design zkvm When the circuit is , Due to the need to identify many custom doors , So a lot of binary selectors have been introduced (binary selector).
With ( site ) Division gate ((field)division gate) For example , We plan to design a door to verify q, x, y Between the three elements q = x/y The relationship is established .
For convenience , We do not perform field division operations at the circuit level , Instead, it is implemented by verifying the following logical relationships .
X * inv_y = q
inv_y∗y = 1 / / Make sure y≠0
Between these two elements , There is an equal relationship . therefore , We have the following Trace surface :

Yes w_0,w_1,w_2,w_3 Column definition polynomial w_0(x), w_1(x), w_2(x), w_3(x), Then the row corresponding to the division operation should meet :
w_0(x) . w_3(x) - w_2(x) = 0 w_1(x) . w_3(x) - 1 = 0
To ensure that the above relationship can be satisfied in the corresponding row , You need a selector to partition it to constrain validation .
therefore , We introduced a new column s_{div} = {0,0,…1,…0}$. When it is converted to a polynomial s_{div}(x) when , The above formula will be :
s_{div}(x) ⋅ (w_0(x) ⋅ w_3(x) - w_2(x)) = 0
s_{div}(x) ⋅ (w_1(x) ⋅ w_3(x) - 1) = 0
Combination selector (Combined Selector)
From the example above , We can see that when we define a new custom door , You need to introduce a selector column s* To correspond to this door .
If we use t * (x) Represents the constraint polynomial corresponding to the gate , We can finally get the following constraints :
s_{add}(x) ⋅ t_{add}(x) = 0
s_{div}(x) ⋅ t_{add}(x) = 0
s_{cube}(x) ⋅ t_{cube}(x) = 0
s_{sqrt}(x) ⋅ t_{sqrt}(x) = 0
…
Because the prover needs to promise all polynomials in the process of generating the proof , Introduce too many selector polynomial It will increase the workload of certifiers and verifiers .
therefore , You need to optimize the number of selectors , At the same time, the following two conditions must be met :
- selector polynomial There is no loss , That is, only certain doors can be used ;
- Less selector polynomial
stay “Plonky2: Fast recursive parameters and PLONK and FRI”(https://github.com/mir-protocol/plonky2/blob/main/plonky2/plonky2.pdf) in , There is an optimization method “Binary-Tree Based Selector”, It will selector polynomial To reduce the number of log(k), k Is the number of custom doors .
stay Halo2 Papers ,zcash The team proposed a new optimization method , A smaller number of polynomials can be realized ( And constrained polynomials t∗(x) And are constrained polynomials max_degree The set parameters are related to ).
To make it easier to understand , Let's take a simple example ( For a particular algorithm , see also Selector combination - The halo2 Book)

We can see , We are 4 A custom door setting 4 Selector Columns , As mentioned earlier , That's not what we want .
This will increase the workload of the verifier and the verifier . Here we define a new column q, Satisfy :

If we are a selector s_{add}, s_{div}, s_{cube}, s_{sqrt} Define a set {s_{add}, s_{div}, s_{cube}, s_{sqrt}( It is called disjoint , Even if there is no common point between possible lines ), So according to the column q The definition of , We have :

ad locum , Column based q Define a new selector polynomial form , For numbers kselector polynomial, We have
:
for example , For constraints :s_add⋅t_add(x) = 0, I could rewrite it as :

Expand the above formula to :


Then we get the truth diagram :

You can see , It does the same thing as the original selector . therefore , For constraints :
s_{add}(x) ⋅ t_{add}(x) = 0
s_{div}(x) ⋅ t_{add}(x) = 0
s_{cube}(x) ⋅ t_{cube}(x) = 0
s_{sqrt}(x) ⋅ t_{sqrt}(x) = 0
…
We can rewrite the constraint as :

For the above constraints , We just need to do the polynomial q(x) Make a commitment . But here's the thing , This approach also increases the degree of constraints .
up to now , We have achieved two things :
- selector polynomial There is no loss , That is, only certain doors can be used ;
- Less selector polynomial
Of course , The degree of constraint in the protocol is limited , Therefore, the number of selectors participating in the combination is bounded , That is, the number of single combinatorial selectors depends on the constraint polynomial t Of Degree and max_degree The boundary value of *(x).
therefore , Need more combined Columns , Anyway, the quantity is still much less than the original .
Source:https://hackernoon.com/how-to-design-the-zkvm-circuit
About
ChinaDeFi - ChinaDeFi.com It's a research driven DeFi Innovation organizations , We are also a blockchain development team . From all over the world every day 500 Close to a good source of information 900 In the content , Looking for deeper thinking 、 Sort out more systematic content , Provide decision-making assistant materials to the Chinese market at the fastest speed .
Layer 2 friends sharing same hobby - Welcome to Layer 2 Interested blockchain technology enthusiasts 、 Study and analyze people and Gavin( WeChat : chinadefi) contact , Discuss together Layer 2 Landing opportunities . Please pay attention to our official account of WeChat “ Decentralized financial community ”.

边栏推荐
- 人大金仓(KingBase)导出表结构
- Django model generates docx database design documents
- 【TcaplusDB知识库】TcaplusDB数据导入介绍
- 【世界海洋日】TcaplusDB号召你一同保护海洋生物多样性
- 一个注解优雅的实现 接口数据脱敏
- leetcode - 295. 数据流的中位数
- 科技云报道:混合办公的B面:安全与效率如何兼得?
- Data collection and management [12]
- Solid state and memory module purchase
- Data collection and management [3]
猜你喜欢

88. (cesium chapter) cesium aggregation diagram

The four traversal methods of the map set can be seen at a glance

Influence of air resistance on the trajectory of table tennis

Vg4131sxxxn0s1 wireless module hardware specification

【FPGA数学公式】使用FPGA实现常用数学公式
![[World Ocean Day] tcapulusdb calls on you to protect marine biodiversity together](/img/87/373af42f3a2ffa6b9f7fb0c0c3735b.png)
[World Ocean Day] tcapulusdb calls on you to protect marine biodiversity together

迅为i.MX8M开发板yocto系统使用Gstarwmr视频转换

87. (cesium chapter) cesium thermal map (pasted with terrain)

Technology cloud report: side B of mixed office: how to have both security and efficiency?
![[FPGA mathematical formula] use FPGA to realize common mathematical formulas](/img/b9/e6f219738b106a96b0f5323ee61cca.png)
[FPGA mathematical formula] use FPGA to realize common mathematical formulas
随机推荐
[FPGA mathematical formula] use FPGA to realize common mathematical formulas
2022年 6月27号 《暑假感悟篇一》路程的选择权。
Requirements analysis specification and requirements specification
谁家的加密密钥,写死在代码里?(说的就是你)
django model生成docx数据库设计文档
Efficientnetv2 - get smaller models and faster training with NAS, scaling, and fused mbconv
中小型企业网络的组建
【滤波器设计】根据设计指标使用matlab定制滤波器
Seekbar custom pictures are not displayed completely up, down, left, right / bitmaptodrawable / bitmaptodrawable inter rotation / paddingstart/paddingend /thumboffset
[World Ocean Day] tcapulusdb calls on you to protect marine biodiversity together
Data collection and management [2]
迅为i.MX8M开发板yocto系统使用Gstarwmr视频转换
【TcaplusDB知识库】查看tcapdir目录服务器
【若依(ruoyi)】ztree初始化
87.(cesium篇)cesium热力图(贴地形)
点云地图导入gazebo思路
Vg4131sxxxn0s1 wireless module hardware specification
Draft competition process of Intelligent Vision Group
seekbar 自定义图片上下左右显示不全 / bitmapToDrawable / bitmapToDrawable互转 / paddingStart/paddingEnd /thumbOffset
87. (cesium chapter) cesium thermal map (pasted with terrain)