Zcash中的description
1. 引言
Zcash 中支持的description类型有:
- JoinSplit description
- Spend description
- Output description
JoinSplit transfer不支持Sapling notes。在Sapling中,有单独的Spend transfer for each shielded input 和 单独的Output transfer for each shielded output。
Sapling中的每一笔交易,都由一系列的Spend descriptions和一系列的Output descriptions组成。
为了保证平衡,需利用Pedersen commitment的加法同态属性,满足:
Com(v1)+Com(v2)=Com(v1+v2)Com(v_1)+Com(v_2)=Com(v_1+v_2)Com(v1)+Com(v2)=Com(v1+v2)
保证交易平衡的具体方法为:【该方案支持所有的zk-SNARK statement为相互独立的,从而增加precomputation的可能机会。】
- 将所有shielded inputs的value commitments相加,减去,所有shielded outputs的value commitments。结果为result commitment。
- 借助Sapling binding signature来证明result commitment为a commit to a value consistent with the net transparent value change。
2. JoinSplit transfer and description
JoinSplit description为:
描述JoinSplit transfer 交易中包含的数据。
所谓JoinSplit transfer即为a shielded value transfer。在Sprout中,这种类型的value transfer是主要的Zcash-specific operation performed by transactions。
3. Spend transfer and description
Spend description为Spend transfer交易中包含的数据。
在Spend transfer中花费note noldn^{old}nold,则其对应的Spend description中包含:
- a Pedersen value commitment to the value of the note。
该Pedersen value commitment与Spend statement instance有关,而Spend statement instance可提供相应的zk-SNARK proof。
在Spend description中指定了 anchor,该anchor指向 前一区块中的output Sapling treestate。
同时,在Spend description中也reveal了nullifier,借助nullifier可发现双花问题。
在Sapling中并不需要Interstitial treestates,因为特定交易中的Spend transfer不支持spend any of the shielded outputs of the same transaction。【实际这种约束并不麻烦,Sprout中要求每个JoinSplit transfer必须是单独平衡的,而在Sapling中,仅要求整个交易是平衡的就足够了。】
相关共识规则为:
- 交易中的Spend transfer和Action transfer必须与其vbalanceSaplingv^{balanceSapling}vbalanceSapling值一致。
- Spend description中的anchor必需指向some earlier block’s final Sapling treestate。
在每笔交易中,可有0个或多个Spend descriptions。
每个Spend description由一个signature 来授权,该signature称为spend authorization signature,可表示为SpendAuthSigSaplingSpendAuthSig^{Sapling}SpendAuthSigSapling。
而ZKSpend为Sapling Spend statement对应的zero-knowledge proving system。
Spend description组成可表示为(cv,rtSapling,nf,rk,πZKSpend,spendAuthSig)(cv, rt^{Sapling},nf,rk,\pi_{ZKSpend}, spendAuthSig)(cv,rtSapling,nf,rk,πZKSpend,spendAuthSig),其中:
- cvcvcv:ValueCommitSaplingValueCommit^{Sapling}ValueCommitSapling。输出为the value commitment to the value of the input note。
- rtSaplingrt^{Sapling}rtSapling:B[lMerkleSapling]\mathbb{B}^{[l_{Merkle}^{Sapling}]}B[lMerkleSapling]为an anchor for the output treestate of a previous block。
- nfnfnf:BY[lPRFnfSapling/8]\mathbb{B}^{\mathbb{Y}^{[l_{PRFnfSapling}/8]}}BY[lPRFnfSapling/8] 为the nullifier for the input note。
- rkrkrk:SpendAuthSigSapling.PublicSpendAuthSig^{Sapling}.PublicSpendAuthSigSapling.Public 为a randomized validating key,用于validate spendAuthSig。
- πZKSpend\pi_{ZKSpend}πZKSpend:ZKSpend.ProofZKSpend.ProofZKSpend.Proof 为a zk-SNAKR proof with primary input (cv,rtSapling,nf,rk)(cv, rt^{Sapling},nf,rk)(cv,rtSapling,nf,rk) for the Spend statement。
- spendAuthSigspendAuthSigspendAuthSig:SpendAuthSigSapling.SignatureSpendAuthSig^{Sapling}.SignatureSpendAuthSigSapling.Signature 为a spend authorization signature。
相关共识规则有:
- Spending description中的elements必须为valid encodings of the types given above。
- cvcvcv和rkrkrk不能是small order的,即[hJ]cv=OJ[h_{\mathbb{J}}]cv=\mathcal{O}_{\mathbb{J}}[hJ]cv=OJ和[hJ]rk=OJ[h_{\mathbb{J}}]rk=\mathcal{O}_{\mathbb{J}}[hJ]rk=OJ必须均不成立。
- proof πZKSpend\pi_{ZKSpend}πZKSpend在给定的除spendAuthSigspendAuthSigspendAuthSig之外的primary input情况下 必须是valid的,即ZKSpend.Verify((cv,rtSapling,nf,rk),πZKSpend)=1ZKSpend.Verify((cv, rt^{Sapling},nf,rk),\pi_{ZKSpend})=1ZKSpend.Verify((cv,rtSapling,nf,rk),πZKSpend)=1 成立。
- 令SigHashSigHashSigHash为该交易的SIGHASH transaction hash,与任何input均无关。则spend authorization signature 必须为a valid SpendAuthSigSaplingSpendAuthSig^{Sapling}SpendAuthSigSapling signature over SigHash using rkrkrk as the validating key,即SpendAuthSigSapling.Validaterk(SigHash,spendAuthSig)=1SpendAuthSig^{Sapling}.Validate_{rk}(SigHash,spendAuthSig)=1SpendAuthSigSapling.Validaterk(SigHash,spendAuthSig)=1成立。
相关非规范性说明:
- 验证rkrkrk不是small order,从技术上来说不需要在Spend circuit中去check,在circuit之外去check会更简单和便宜。
- 约束rkrkrk和cvcvcv不能是small order有助于防范non-canonical encodings of theses fields。即要求reprJ(abstJ(cv))=cvrepr_{\mathbb{J}}(abst_{\mathbb{J}}(cv))=cvreprJ(abstJ(cv))=cv和reprJ(abstJ(rk))=rkrepr_{\mathbb{J}}(abst_{\mathbb{J}}(rk))=rkreprJ(abstJ(rk))=rk均成立。
Spend description相应的编码组成为:
4. Output transfer and description
Output description为Output transfer交易中包含的数据。
在Output transfer中创建note nnewn^{new}nnew,则其对应的Output description中包含:
- a Pedersen value commitment to the value of the note。
该Pedersen value commitment与Output statement instance有关,而Output statement instance可提供相应的zk-SNARK proof。
在每笔交易中,可包含0个或多个Output descriptions。在Output description中没有任何相关signatures。
而ZKOutput为Sapling Output statement对应的zero-knowledge proving system。
Output description的组成可表示为(cv,cmu,epk,Cenc,Cout,πZKOutput)(cv, cm_{u}, epk, C^{enc}, C^{out}, \pi_{ZKOutput})(cv,cmu,epk,Cenc,Cout,πZKOutput),其中:
- cvcvcv:ValueCommitSaplingValueCommit^{Sapling}ValueCommitSapling。输出为the value commitment to the value of the output note。
- cmucm_ucmu:B[lMerkleSapling]\mathbb{B}^{[l_{Merkle}^{Sapling}]}B[lMerkleSapling]为the result of applying ExtractJ(r)Extract_{\mathbb{J}^{(r)}}ExtractJ(r) to the note commitment for the output note。
- epkepkepk:KASapling.PublicKA^{Sapling}.PublicKASapling.Public为a key agreement public key,用于derive the key for encryption of the transmitted note ciphertext。
- CencC^{enc}Cenc:Sym.CSym.CSym.C 为a ciphertext component for the encrypted output note。
- CoutC^{out}Cout:Sym.CSym.CSym.C 为a ciphertext component,其支持用于full viewing key的人恢复the diversified transimission key pkdpk_dpkd和the ephemeral private key eskeskesk,甚至可恢复整个note plaintext。
- πZKOutput\pi_{ZKOutput}πZKOutput:ZKOutput.ProofZKOutput.ProofZKOutput.Proof为a zk-SNARK proof with primary input (cv,cmu,epk)(cv,cm_u, epk)(cv,cmu,epk) for the Output statement。
相关共识规则有:
- Output description中的elements必须是valid encodings of the types given above。
- cv和epkcv和epkcv和epk 必须不能是small order的,即[hJ]cv=OJ[h_{\mathbb{J}}]cv=\mathcal{O}_{\mathbb{J}}[hJ]cv=OJ和[hJ]epk=OJ[h_{\mathbb{J}}]epk=\mathcal{O}_{\mathbb{J}}[hJ]epk=OJ必须均不成立。
- proof πZKOutput\pi_{ZKOutput}πZKOutput在给定的除Cenc和CoutC^{enc}和C^{out}Cenc和Cout之外的primary input情况下 必须是valid的,即ZKOutput.Verify((cv,cmu,epk),πZKOutput)=1ZKOutput.Verify((cv, cm_u,epk),\pi_{ZKOutput})=1ZKOutput.Verify((cv,cmu,epk),πZKOutput)=1 成立。
相关非规范说明:
- 约束cv和epkcv和epkcv和epk不能为small order,有助于防范non-canonical encodings of these fields。即要求reprJ(abstJ(cv))=cvrepr_{\mathbb{J}}(abst_{\mathbb{J}}(cv))=cvreprJ(abstJ(cv))=cv和reprJ(abstJ(epk))=epkrepr_{\mathbb{J}}(abst_{\mathbb{J}}(epk))=epkreprJ(abstJ(epk))=epk均成立。
Output description相应的编码组成为:
参考资料
[1] Zcash Protocol Specification
Zcash中的description相关推荐
- Zcash中的signatures
1. 引言 在 Zcash Protocol Specification 中,约定对signature是"validate",对zk-SNARK proof是"verif ...
- Zcash中的加解密机制
1. 引言 接前序博客 Zcash中的Notes. Sapling note的组成为tuple n=(d,pkd,v,rcm)\mathbf{n}=(d, pk_d, v, rcm)n=(d,pkd ...
- Zcash中的Notes
1. 引言 本文主要关注Sapling note. Zcash中Sapling note以n\mathbf{n}n表示,其代表a value vvv is spendable by the recip ...
- Zcash中的keys和addresses
1. 引言 [还有个ockockock:outgoing cipher key,用于encrypt an outgoing ciphertext.] 在Zcash协议中,用户若想接收shielded ...
- Zcash中的zk-SNARK statements
1. 引言 zero-knowledge proving system为a cryptographic protocol,用于证明: a particular statement,dependent ...
- Zcash中的hash函数
1. 引言 Zcash中的hash函数主要有: BLAKE2 Hash Function Group Hash into Jubjub Pedersen Hash Function Mixing Pe ...
- python中description_python中cursor.description什么意思
展开全部 connection=MySQLdb.connect(host='localhost',user='用户名',passwd='密码',db='数据库 名',charset='gbk') ( ...
- OC中对象的description方法
周所周知,我们在做项目时, 可以在类的.m文件中重写该类的对象的描述description方法: 示例: -(NSString *)description { NSString *str = ...
- Element UI中Steps 步骤条description描述换行展示
突然要求加了个显示字段,之前的代码只能显示一行,于是乎找到了解决办法,代码如下:其中的属性自行到官网查看释义吧:Element UI官网传送门 <el-table><!-- 可展开的 ...
最新文章
- SRE工程师到底是做什么的?
- mingw 编译 libopus 1.3.1 时 注意事项
- 世界最成功的僵尸网络使用Fast Flux技术躲避检测
- 函数指针,指针函数,数组指针,指针数组 区分
- node.js博客GitHub搭建(hexo)
- 8. Python 数据类型
- 前端学习(2611):vuex实现增加
- 英雄会被表彰,这些技术与代码也将载入史册!
- PHP类分享:session保存到数据库
- Aliplayer 阿里云播放器自定义视弹出框 包含全屏
- java的hashmap排序_java 中HashMap排序
- 同款视频一键制作生成微信小程序源码下载恶搞视频,特效视频,唯美视频等等
- wps如何设置分段页眉
- sis最新ip地址2020入口一_2020云南高考成绩公布时间最新 云南高考查成绩方式入口大全...
- Tapestry 4.1.3学习心得
- 【许晓笛】 EOS智能合约案例解析(1) 1
- Obama's speech in Chicago
- 文件或目录结构损坏且无法读取快速恢复数据的方法
- linux宝塔重新安装,Linux服务器Windows系统 安装和卸载宝塔面板
- 活体检测CDCN学习笔记
热门文章
- 小羊的暑假博客计划教程索引
- 英语口语考试资料Food
- 自己用的感觉很好的C++IDE推荐
- python实现哈夫曼树的可视化
- Database System Concepts(Fourth Edition)
- redis存取list<T>,及bug:Failed to serialize object of type: class com.google.common.collect.Lists$Revers
- 爬虫笔记(一)——Requests库
- C语言中实现十进制转二进制输出
- VRF(虚拟路由转发)
- Js中的作用域和作用域链