Zcash 백서

Zcash

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 7쪽

ince a vanity address can obviously be distinguished, and might leak more information than intended as to who created it. • Similarly, address generatorsMAYencode information in thediversifierthat can be recovered by the recipient of a payment to determine whichdiversified payment addresswas used. It isRECOMMENDED, instead of directly encoding information in thediversifier, to encode it in thediversifier indexspecified in [ZIP-32]. This ensures that the information is only accessible to a holder of thediversifier keydk. Non-normative notes: •Assume thatPRF expand is aPRFwith output rangeB Y Y[ℓPRFexpand/8], where2 ℓPRFexpand is large compared to𝑟 J. Define𝑓 B[ℓsk]×B Y Y[N]→F 𝑟J by𝑓 sk(𝑡) :=ToScalar Sapling(︀PRFexpandsk (𝑡))︀. 𝑓 is also aPRFsince LEOS2IPℓPRFexpand BY Y[ℓPRFexpand/8]→{0..2 ℓPRFexpand−1} is injective; the bias introduced by reduc- tion modulo 𝑟J is small because §5.3 ‘Constants’ on p. 77 defines ℓPRFexpand as 512, while 𝑟J has length 252 bits. It follows that the distribution of ask, i.e. PRFexpandsk ([0]) :sk←R B[ℓsk], is computationally indistinguishable from SpendAuthSigSapling.GenPrivate() defined in §5.4.7.1 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.98. • The distribution of nsk, i.e. ToScalarSapling(︀PRFexpandsk ([1]))︀ :sk← R B[ℓsk], is computationally indistinguishable from the uniform distribution on F𝑟J. Since nsk F𝑟J↦→repr J (︀ [nsk]ℋ Sapling J⋆(𝑟))︀ is bijective, the distribution of reprJ(nk)will be computationally indistinguishable from uniform onJ ⋆ (𝑟) (the keyspace ofPRF nfSapling). 39 4.2.3OrchardKey Components #orchardkeycomponents Letℓ PRFexpand,ℓ sk,ℓ ovk,ℓ d, andℓ dk be as defined in §5.3 ‘Constants’ on p.77. LetP,repr P,ℓ P,𝑞 P, and𝑟 P be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. LetExtract P be as defined in §5.4.9.7 ‘Coordinate Extractor for Pallas’ on p.109. LetGroupHash P be as defined in §5.4.9.8 ‘Group Hash into Pallas and Vesta’ on p.110. LetPRF expand andPRF ockOrchard be as defined in §5.4.2 ‘Pseudo Random Functions’ on p.89. LetDeriveInternalFVK Orchard be as defined in [ZIP-32, Orchard internal key derivation]. LetPRP d BY Y[ℓdk/8]×B [ℓd]→B [ℓd] be as defined in §5.4.4 ‘Pseudo Random Permutations’ on p.91. LetKA Orchard, instantiated in §5.4.5.5 ‘Orchard Key Agreement’ on p.93, be akey agreement scheme. LetCommit ivk, instantiated in §5.4.8.4 ‘Sinsemilla commitments’ on p.101, be acommitment scheme. Let DiversifyHashOrchardbe as defined in §5.4.1.6 ‘DiversifyHashSapling andDiversifyHash Orchard Hash Functions’ on p. 81. Let SpendAuthSigOrchard instantiated in §5.4.7.1 ‘Spend Authorization Signature (Sapling and Orchard)’ on p. 98 be asignature scheme with re-randomizable keys. LetI2LEBSP,I2LEOSP, andLEOS2IPbe as defined in §5.1 ‘Integers, Bit Sequences, and Endianness’ on p.76. DefineToBase Orchard(𝑥 BY Y[ℓPRFexpand/8]) :=LEOS2IP ℓPRFexpand(𝑥) (mod𝑞 P). DefineToScalar Orchard(𝑥 BY Y[ℓPRFexpand/8]) :=LEOS2IP ℓPRFexpand(𝑥) (mod𝑟 P). DefineDeriveDkAndOvk Orchard(rivk F𝑟P ,ak {0.. 𝑞P−1},nk F𝑞P)as follows: let𝐾=I2LEBSP ℓsk(rivk) let𝑅=PRF expand𝐾 (︀[0x82]||I2LEOSP 256(ak)||I2LEOSP 256(nk))︀ letdk BY Y[ℓdk/8] be the firstℓ dk/8bytes of𝑅and letovk BY Y[ℓovk/8] be the remainingℓ ovk/8bytes of𝑅. return(dk,ovk) A new Orchardspending keyskis generated by choosing abit sequenceuniformly at random fromB [ℓsk]. From thisspending key, theSpend authorizing key ask F*𝑟P, theSpend validating key ak {0.. 𝑞P−1} , thenullifier deriving key nk F𝑞P, the Commitivk randomness rivk F𝑟P, thediversifier key dk BY Y[ℓdk/8], the KAOrchard private key ivk {1.. 𝑞P−1} , theoutgoing viewing key ovk BY Y[ℓovk/8], and corresponding “internal” keys are derived as follows: let mutableask←ToScalar Orchard(︀PRFexpandsk ([6]))︀ letnk=ToBase Orchard(︀PRFexpandsk ([7]))︀ letrivk=ToScalar Orchard(︀PRFexpandsk ([8]))︀ ifask= 0, discard this key and repeat with a newsk. letak P =SpendAuthSig Orchard.DerivePublic(ask) if the last bit (that is, the˜𝑦bit) ofrepr P(akP)is1: setask←−ask letak=Extract P(akP) letivk=Commit ivkrivk(︀ak,nk )︀ ifivk∈{0,⊥}, discard this key and repeat with a newsk. let(dk,ovk) =DeriveDkAndOvk Orchard(rivk,ak,nk) let(ak internal,nk internal,rivk internal) =DeriveInternalFVK Orchard(ak,nk,rivk) 40 letivk internal =Commit ivkrivkinternal (︀akinternal,nk internal)︀ ifivk internal∈{0,⊥}, discard this key and repeat with a newsk. let(dk internal,ovk internal) =DeriveDkAndOvk Orchard(︀rivkinternal,ak internal,nk internal)︀. Note:ak internal =akandnk internal =nk. As explained in §3.1 ‘Payment Addresses and Keys’ on p. 14, Orchardallows the efficient creation of multiple diversified payment addresseswith the samespending authority. A group of such addresses shares the samefull viewing key,incoming viewing key, andoutgoing viewing key. To create a newdiversified payment addressgiven anincoming viewing key (dk,ivk) , pick adiversifier index index uniquely fromB [ℓd]. Then calculate thediversifierdand thediversified transmission keypk d: d:=PRP ddk(index) gd :=DiversifyHash Orchard(d) pkd :=KA Orchard.DerivePublic(ivk,g d). The resultingdiversified payment addressis(d B[ℓd],pk d KAOrchard.PublicPrimeOrder). Thediversified payment addresswithdiversifier index0is called thedefault diversified payment address. Notes: • Diversifier indicesSHOULD NOTbe chosen at random. [ZIP-32] specifies their usage in the context of hierarchical deterministic wallets. • Address generatorsMAYencode information in thediversifier indexthat can be recovered by the recipient of a payment, given thediversifier key. •rivk is used both as a randomizer for Commitivk, and as a key for PRFexpand to derive dk and ovk. If dk and ovk are known to an adversary, then this reuse prevents proving that the use ofCommitivk in this context is perfectlyhiding. It is also not sufficient to model PRFexpand only as a PRF. In practice, we believe it would be extremely surprising if there were an exploitable interaction between scalar multiplication used in Commitivk, and BLAKE2b used to instantiate PRFexpand. It is possible, albeit somewhat inelegantly, to model this usage by a joint assumption onPallasscalar multiplication andPRF expand. Non-normative notes: •The uses ofToScalar Orchard andToBase Orchard produce output that is uniform onF 𝑟P andF 𝑞P respectively when applied to random input, by a similar argument to that used in §4.2.2 ‘Sapling Key Components’ on p.38. • The output of Commitivk is theaffine-short-Weierstrass 𝑥-coordinate of aPallas curvepoint, which we then use as a KAOrchard private key ivk fornoteencryption. The fact that ivk is non-uniform on F𝑟P (since it can only take on roughly half of the possible values) is not expected to cause any security issue. 4.3 JoinSplit Descriptions #joinsplitdesc AJoinSplit transfer, as specified in §3.5 ‘JoinSplit Transfers and Descriptions’ on p. 20, is encoded intransactions as aJoinSplit description. Eachtransactionincludes a sequence of zero or moreJoinSplit descriptions. When this sequence is non-empty, thetransactionalso includes encodings of aJoinSplitSigpublicvalidating keyand signature. Letℓ SproutMerkle,ℓ SproutPRF ,ℓ Seed,N old,N new, andMAX_MONEYbe as defined in §5.3 ‘Constants’ on p.77. LethSigCRHbe as defined in §4.1.1 ‘Hash Functions’ on p.26. 41 LetNoteCommit Sprout be as defined in §4.1.8 ‘Commitment’ on p.32. LetKA Sprout be as defined in §4.1.5 ‘Key Agreement’ on p.28. LetSymbe as defined in §4.1.4 ‘Symmetric Encryption’ on p.28. LetZKJoinSplitbe as defined in §4.1.13 ‘Zero-Knowledge Proving System’ on p.36. AJoinSplit descriptioncomprises(v oldpub,v newpub ,rt Sprout,nf old1..Nold ,cm new1..Nnew ,epk,randomSeed,h 1..Nold , 𝜋ZKJoinSplit,C enc1..Nnew)where •v oldpub {0..MAX_MONEY} is the value that theJoinSplit transferremoves from thetransparent transaction value pool; •v newpub {0..MAX_MONEY} is the value that theJoinSplit transferinserts into thetransparent transaction value pool; •rt Sprout B[ℓSproutMerkle] is ananchor, as defined in §3.4 ‘Transactions and Treestates’ on p. 19, for the outputtreestate of either a previousblock, or a previousJoinSplit transferin thistransaction. •nf old1..Nold B[ℓSproutPRF ][Nold] is the sequence ofnullifiersfor the inputnotes; •cm new1..Nnew NoteCommitSprout.Output[Nnew] is the sequence ofnote commitmentsfor the outputnotes; •epk KASprout.Public is a key agreementpublic key, used to derive the key for encryption of thetransmitted notes ciphertext( §4.19 ‘In-band secret distribution (Sprout)’ on p.68); •randomSeed B[ℓSeed] is a seed that must be chosen independently at random for eachJoinSplit description; •h 1..Nold B[ℓSproutPRF ][Nold] is a sequence of tags that bindh Sig to eacha sk of the inputnotes; •𝜋 ZKJoinSplit ZKJoinSplit.Proof is azk proofwithprimary input (rtSprout,nf old1..Nold ,cm new1..Nnew ,v oldpub,v newpub ,h Sig,h 1..Nold)for theJoinSplit statementdefined in §4.18.1 ‘JoinSplit Statement (Sprout)’ on p. 63 (this is a BCTV14 proof before Saplingactivation, and aGroth16proof after Saplingactivation); •C enc1..Nnew Sym.C[Nnew] is a sequence of ciphertext components for the encrypted outputnotes. The ephemeralKey and encCiphertexts fields together form thetransmitted notes ciphertext. The valueh Sig is also computed fromrandomSeed,nf old1..Nold, and the joinSplitPubKey of the containingtransaction: hSig :=hSigCRH(randomSeed,nf old1..Nold , joinSplitPubKey). Consensus rules: • Elements of aJoinSplit descriptionMUSThave the types given above (for example: 0≤v oldpub≤MAX_MONEY and0≤v newpub≤MAX_MONEY). • The proof 𝜋ZKJoinSplit MUSTbe valid given aprimary inputformed from the relevant other fields and hSig — i.e. ZKJoinSplit.Verify (︀ (rtSprout,nf old1..Nold ,cm new1..Nnew ,v oldpub,v newpub ,h Sig,h 1..Nold), 𝜋ZKJoinSplit)︀ = 1. •Eitherv oldpub orv newpub MUSTbe zero. •[Canopyonward]v oldpub MUSTbe zero. 4.4 Spend Descriptions #spenddesc ASpend transfer, as specified in §3.6 ‘Spend Transfers, Output Transfers, and their Descriptions’ on p. 21, is encoded intransactionsas aSpend description. Eachtransactionincludes a sequence of zero or moreSpend descriptions. EachSpend descriptionis authorized by a signature, called thespend authorization signature. 42 Letℓ SaplingMerkle andℓ PRFnfSapling be as defined in §5.3 ‘Constants’ on p.77. Let𝒪 J,abst J,repr J, andℎ J be as defined in §5.4.9.3 ‘Jubjub’ on p.105. LetValueCommit Sapling.Outputbe as defined in §4.1.8 ‘Commitment’ on p.32. LetSpendAuthSig Sapling be as defined in §4.15 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.59. LetZKSpendbe as defined in §4.1.13 ‘Zero-Knowledge Proving System’ on p.36. ASpend descriptioncomprises(cv,rt SaplingPool,nf,rk, 𝜋ZKSpend,spendAuthSig)where •cv ValueCommitSapling.Outputis thevalue commitmentto the value of the inputnote; •rt SaplingPool B[ℓSaplingMerkle ] is ananchor, as defined in §3.4 ‘Transactions and Treestates’ on p. 19, for the output treestateof a previousblock; •nf BY Y[ℓPRFnfSapling/8] is thenullifierfor the inputnote; •rk SpendAuthSigSapling.Publicis a randomizedvalidating keythat should be used to validatespendAuthSig; •𝜋 ZKSpend ZKSpend.Proof is azk-SNARK proofwithprimary input (cv,rt SaplingPool,nf,rk) for the SaplingSpend statementdefined in §4.18.2 ‘Spend Statement (Sapling)’ on p.64; •spendAuthSig SpendAuthSigSapling.Signature is aspend authorization signature, validated as specified in §4.15 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.59. Consensus rules: •Elements of aSpend descriptionMUSTbe valid encodings of the types given above. •cvandrkMUST NOTbe ofsmall order, i.e.[ℎ J]cvMUST NOTbe𝒪 J and[ℎ J]rkMUST NOTbe𝒪 J. • The proof 𝜋ZKSpend MUSTbe valid given aprimary inputformed from the other fields except spendAuthSig — i.e.ZKSpend.Verify (︀ (cv,rt SaplingPool,nf,rk), 𝜋ZKSpend)︀ = 1. • Let SigHash be theSIGHASH transaction hashof thistransaction, not associated with an input, as defined in §4.10 ‘SIGHASH Transaction Hashing’ on p.53 usingSIGHASH_ALL. Thespend authorization signatureMUSTbe a valid SpendAuthSigSapling signature over SigHash using rk as the validating key— i.e.SpendAuthSig Sapling.Validaterk(SigHash,spendAuthSig) = 1. [ NU5 onward] As specified in §5.4.7 ‘RedDSA,RedJubjub, andRedPallas’ on p. 95, the validation of the 𝑅 component of the signature changes to prohibitnon-canonicalencodings. This change is also retrospectively valid onMainnetandTestnetbefore NU5. Non-normative notes: • As stated in §5.4.8.3 on p. 99, an implementation of HomomorphicPedersenCommitSapling MAYresample the commitment trapdooruntil the resulting commitment is not𝒪 J. •The rule thatcvandrkMUSTnot besmall-orderhas the effect of also preventingnon-canonicalencodings of these fields, as required by [ZIP-216]. That is, it is necessarily the case that reprJ (︀ abstJ(cv) )︀ =cv and reprJ (︀ abstJ(rk) )︀ =rk. 4.5 Output Descriptions #outputdesc AnOutput transfer, as specified in §3.6 ‘Spend Transfers, Output Transfers, and their Descriptions’on p. 21, is encoded intransactionsas anOutput description. Eachtransactionincludes a sequence of zero or moreOutput descriptions. There are no signatures associated withOutput descriptions. Letℓ SaplingMerkle be as defined in §5.3 ‘Constants’ on p.77. 43 Let𝒪 J,abst J,repr J, andℎ J be as defined in §5.4.9.3 ‘Jubjub’ on p.105. LetValueCommit Sapling.Outputbe as defined in §4.1.8 ‘Commitment’ on p.32. LetKA Sapling be as defined in §4.1.5 ‘Key Agreement’ on p.28. LetSymbe as defined in §4.1.4 ‘Symmetric Encryption’ on p.28. LetZKOutputbe as defined in §4.1.13 ‘Zero-Knowledge Proving System’ on p.36. AnOutput descriptioncomprises(cv,cm 𝑢,epk,C enc,C out, 𝜋ZKOutput)where •cv ValueCommitSapling.Outputis thevalue commitmentto the value of the outputnote; •cm 𝑢 B[ℓSaplingMerkle ] is the result of applying ExtractJ(𝑟) (defined in §5.4.9.4 ‘Coordinate Extractor for Jubjub’ on p.107) to thenote commitmentfor the outputnote; •epk KASapling.Public is a key agreementpublic key, used to derive the key for encryption of thetransmitted note ciphertext( §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p.70); •C enc Sym.Cis a ciphertext component for the encrypted outputnote; •C out Sym.C is a ciphertext component that allows the holder of theoutgoing cipher key(which can be derived from afull viewing key) to recover the recipientdiversified transmission key pkd and theephemeral private keyesk, hence the entirenote plaintext; •𝜋 ZKOutput ZKOutput.Proof is azk-SNARK proofwithprimary input (cv,cm 𝑢,epk) for theOutput statement defined in §4.18.3 ‘Output Statement (Sapling)’ on p.65. Consensus rules: •Elements of anOutput descriptionMUSTbe valid encodings of the types given above. •cvandepkMUST NOTbe ofsmall order, i.e.[ℎ J]cvMUST NOTbe𝒪 J and[ℎ J]epkMUST NOTbe𝒪 J. • The proof 𝜋ZKOutput MUSTbe valid given aprimary inputformed from the other fields except Cenc and Cout — i.e.ZKOutput.Verify (︀ (cv,cm 𝑢,epk), 𝜋ZKOutput )︀ = 1. Non-normative notes: • As stated in §5.4.8.3 on p. 99, an implementation of HomomorphicPedersenCommitSapling MAYresample the commitment trapdooruntil the resulting commitment is not𝒪 J. • The rule that cv and epk MUSTnot besmall-orderhas the effect of also preventingnon-canonicalencodings of these fields, as required by [ZIP-216]. That is, it is necessarily the case that reprJ (︀ abstJ(cv) )︀ =cv and reprJ (︀ abstJ(epk) )︀ =rk. 4.6 Action Descriptions #actiondesc AnAction transfer, as specified in §3.7 ‘Action Transfers and their Descriptions’ on p. 22, is encoded intrans- actionsas anAction description. Each version 5transactionhas a sequence ofAction descriptionsfor the Orchard pool. Version 4transactions cannot containAction descriptions. 44 EachAction descriptionis authorized by a signature, called thespend authorization signature. Letℓ OrchardMerkle be as defined in §5.3 ‘Constants’ on p.77. Let𝑞 P be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. LetExtract P be as defined in §5.4.9.7 ‘Coordinate Extractor for Pallas’ on p.109. LetValueCommit Orchard.Outputbe as defined in §4.1.8 ‘Commitment’ on p.32. LetSpendAuthSig Orchard be as defined in §4.15 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.59. LetKA Orchard be as defined in §4.1.5 ‘Key Agreement’ on p.28. LetSymbe as defined in §4.1.4 ‘Symmetric Encryption’ on p.28. LetZKActionbe as defined in §4.1.13 ‘Zero-Knowledge Proving System’ on p.36. Let vk be the Halo 2 verifying keyidentified by the Orchardcircuit version, as specified in the consensus rules below. AnAction descriptioncomprises (cvnet,rt OrchardPool,nf,rk,spendAuthSig,cm 𝑥,epk,C enc,C out,enableSpends,enableOutputs, 𝜋)where: •cv net ValueCommitOrchard.Output is thevalue commitmentto the value of the inputnoteminus the value of the outputnote; •rt OrchardPool {0.. 𝑞P−1} is ananchor, as defined in §3.4 ‘Transactions and Treestates’ on p. 19, for the output treestateof a previousblock; •nf {0.. 𝑞P−1}is thenullifierfor the inputnote; •rk SpendAuthSigOrchard.Publicis a randomizedvalidating keythat should be used to validatespendAuthSig; •spendAuthSig SpendAuthSigOrchard.Signature is aspend authorization signature, validated as specified in §4.15 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.59; •cm 𝑥 {0.. 𝑞P−1}is the result of applyingExtract P to thenote commitmentfor the outputnote; •epk KAOrchard.Public is a key agreementpublic key, used to derive the key for encryption of thetransmitted note ciphertext( §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p.70); •C enc Sym.Cis a ciphertext component for the encrypted outputnote; •C out Sym.C is a ciphertext component that allows the holder of theoutgoing cipher key(which can be derived from afull viewing key) to recover the recipientdiversified transmission key pkd and theephemeral private keyesk, hence the entirenote plaintext; •enableSpends Bis a flag that is set in order to enable non-zero-valued spends in this Action; •enableOutputs Bis a flag that is set in order to enable non-zero-valued outputs in this Action; •enableCrossAddress B is a flag that is set in order to enable theexpanded receiverof the outputnoteto be different from theexpanded receiverof the inputnotein this Action [ZIP-2006]; •𝜋 OrchardPool ZKAction.Proof is azk-SNARK prooffor theAction statementdefined in §4.18.4 on p. 66, with primary input (cv,rt OrchardPool,nf,rk,cm 𝑥,enableSpends,enableOutputs,disableCrossAddress) where disableCrossAddress= 1−enableCrossAddress. Note:The rtOrchardPool, enableSpendsOrchard, and enableOutputsOrchard components are the same for allAction transfersin atransaction, and are encoded once in thetransactionbody ( §7.1 ‘Transaction Encoding and Consensus’ on p. 125), not the ActionDescription structure. 𝜋OrchardPool is aggregated with other OrchardPoolAction proofs and encoded in the proofsOrchard field. 45 Consensus rules: •Elements of anAction descriptionMUSTbe canonical encodings of the types given above. • Let SigHash be theSIGHASH transaction hashof thistransaction, not associated with an input, as defined in §4.10 ‘SIGHASH Transaction Hashing’ on p.53 usingSIGHASH_ALL. Thespend authorization signatureMUSTbe a valid SpendAuthSigOrchard signature over SigHash using rk as thevalidating key— i.e. SpendAuthSigOrchard.Validaterk(SigHash,spendAuthSig) = 1 . As specified in §5.4.7 ‘RedDSA,RedJubjub, andRedPallas’ on p. 95, validation of the 𝑅 component of the signature prohibitsnon- canonicalencodings. • [ NU5 to NU6.1 inclusive, pre- NU6.2] vk MUSTbe theverifying keyidentified by OrchardCircuitVersion:: InsecurePreNU6_2. [ NU6.2 only] vk MUSTbe theverifying keyidentified by OrchardCircuitVersion::FixedPostNU6_2. • The proof𝜋OrchardPool MUSTbe valid forverifying key vk given aprimary input (cv,rt OrchardPool,nf,rk,cm 𝑥,enableSpends, enableOutputs) — i.e. ZKAction.Verifyvk (︀ (cv,rt OrchardPool,nf,rk,cm 𝑥,enableSpends,enableOutputs), 𝜋OrchardPool)︀ = 1. •rkMUST NOTbe the identity point𝒪 P. Non-normative notes: •cvcan be the zero point𝒪 P.rkandepkcannot be𝒪 P. • The restriction rk̸=𝒪 P was enforced as a “soft fork” , without a specific
프로젝트로 돌아가기