bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 3쪽
ation
above for the unique representative of a field element.)
𝑎⊕𝑏 means the bitwise-exclusive-or of 𝑎 and 𝑏, and 𝑎î𝑏 means the bitwise-and of 𝑎 and 𝑏. These are defined
on integers (which include bits and bytes), or elementwise on equal-length sequences of integers, according to
context.
N∑︁
𝑖=1
𝑎𝑖 means the sum of𝑎 1..N.
N∏︁
𝑖=1
𝑎𝑖 means the product of𝑎 1..N.
N⨁︁
𝑖=1
𝑎𝑖 means the bitwise-exclusive-or of𝑎 1..N.
When 𝑁= 0 these yield the appropriate neutral element, i.e.
∑︀0
𝑖=1𝑎𝑖 = 0,
∏︀0
𝑖=1𝑎𝑖 = 1, and
⨁︀0
𝑖=1𝑎𝑖 = 0 or the
all-zerobit sequenceof length given by the type of𝑎.
+√𝑎 , where 𝑎 F𝑞, means the positive square root of 𝑎 in F𝑞, i.e. in the range {︀0.. 𝑞−12 }︀. It is only used in cases where
the square root must exist.
?√𝑎 , where𝑎 F𝑞, means an arbitrary square root of𝑎inF 𝑞, or⊥if no such square root exists.
𝑏 ? 𝑥:𝑦means𝑥when𝑏= 1, or𝑦when𝑏= 0.
𝑎𝑏, for𝑎an integer or finite field element and𝑏 Z, means the result of raising𝑎to the exponent𝑏, i.e.
𝑎𝑏 :=
⎧
⎪⎨
⎪⎩
∏︀𝑏
𝑖=1 𝑎,if𝑏≥0
∏︀−𝑏
𝑖=1
1
𝑎 ,otherwise.
The[𝑘]𝑃notation for scalar multiplication in a group is defined in §4.1.9 ‘Represented Group’ on p.34.
The convention of affixing ⋆ to a variable name is used for variables that denotebit sequencerepresentations of
group elements.
The binary relations <,≤, =,≥, and > have their conventional meanings on integers and rationals, and are defined
lexicographically on sequences of integers.
floor(𝑥)means the largest integer≤𝑥.ceiling(𝑥)means the smallest integer≥𝑥.
bitlength(𝑥), for𝑥 N, means the smallest integerℓsuch that2 ℓ > 𝑥.
12
The following integer constants will be instantiated in §5.3 ‘Constants’ on p.77:
MerkleDepthSprout,MerkleDepth Sapling,MerkleDepth Orchard,ℓ SproutMerkle,ℓ SaplingMerkle ,ℓ OrchardMerkle ,N old,N new,ℓ value,ℓ hSig,ℓ SproutPRF ,
ℓPRFexpand,ℓ PRFnfSapling,ℓ Sproutrcm ,ℓ Seed,ℓ ask,ℓ Sproutφ ,ℓ sk,ℓ d,ℓ dk,ℓ Saplingivk ,ℓ ovk,ℓ Saplingscalar ,ℓ Orchardscalar ,ℓ Orchardbase ,MAX_MONEY,
BlossomActivationHeight,CanopyActivationHeight,ZIP212GracePeriod,SlowStartInterval,PreBlossomHalvingInterval,
MaxBlockSubsidy,NumFounderAddresses,PoWLimit,PoWAveragingWindow,PoWMedianBlockSpan,
PoWDampingFactor,PreBlossomPoWTargetSpacing, andPostBlossomPoWTargetSpacing.
The rational constants FoundersFraction, PoWMaxAdjustDown, and PoWMaxAdjustUp; thebit-sequenceconstants
UncommittedSprout B[ℓSproutMerkle] and UncommittedSapling B[ℓSaplingMerkle ]; and the constant UncommittedOrchard {0.. 𝑞P−1} will
also be defined in that section.
We use the abbreviation “ctEdwards” to refer tocomplete twisted Edwards elliptic curvesand coordinates (see
§5.4.9.3 ‘Jubjub’ on p.105).
13
3 Concepts #concepts
3.1 Payment Addresses and Keys #addressesandkeys
Users who wish to receive shielded payments in theZcashprotocol must have ashielded payment address, which
is generated from aspending key.
The following diagrams depict the relations between key components in Sproutand Saplingand Orchard. Arrows
point from a component to any other component(s) that can be derived from it. Double lines indicate that the same
component is used in multiple abstractions.
[ Sprout] A Sproutreceiving key skenc,incoming viewing key ivk= (a pk,sk enc), andshielded payment address
addrpk = (apk,pk enc) are derived from thespending key ask, as described in §4.2.1 ‘Sprout Key Components’ on p. 38.
[ Sapling onward] A Saplingexpanded spending keyis composed of aSpend authorizing key ask, anullifier private
key nsk, and anoutgoing viewing key ovk. From these components we can derive aproof authorizing key (ak,nsk) , a
full viewing key(ak,nk,ovk) , anincoming viewing key ivk, and a set ofdiversified payment addressesaddrd = (d,pk d),
as described in §4.2.2 ‘Sapling Key Components’ on p.38.
The consensus protocol does not depend on how anexpanded spending keyis constructed. Two methods of doing
so are defined:
1. Generate aspending key sk at random and derive theexpanded spending key (ask,nsk,ovk) from it, as shown
in the diagram above and described in §4.2.2 ‘Sapling Key Components’ on p.38.
2. Obtain anextended spending keyas specified in [ZIP-32]; this includes a superset of the components of an
expanded spending key. This method is used in the context of aHierarchical Deterministic Wallet.
[ NU5 onward] An Orchardspending key sk is used to derive aSpend authorizing key ask, and afull viewing key
(ak,nk,rivk) . From thefull viewing keywe can also derive anincoming viewing key(composed of adiversifier
key dk and a KAOrchard private key ivk), anoutgoing viewing key ovk, and a set ofdiversified payment addresses
addrd = (d,pk d), as described in §4.2.3 ‘Orchard Key Components’ on p.40.
* The derivations ofaskandrivkshown are not the only possibility. For further detail see §4.2.3 on p.40.
Non-normative note:MostZcashwallets derive Saplingand Orchardkeys and addresses according to [ZIP-32].
14
The composition ofshielded payment addresses,incoming viewing keys,full viewing keys, andspending keysis
a cryptographic protocol detail that should not normally be exposed to users. However, user-visible operations
should be provided to obtain ashielded payment address,incoming viewing key, orfull viewing keyfrom aspending
keyorextended spending key.
Users can accept payment from multiple parties with a singleshielded payment addressand the fact that these
payments are destined to the same payee is not revealed on theblock chain, even to the paying parties. However if
two parties collude to compare ashielded payment addressthey can trivially determine they are the same. In the
case that a payee wishes to prevent this they should create a distinctshielded payment addressfor each payer.
[ Sapling onward] Saplingand Orchardprovide a mechanism to allow the efficient creation ofdiversified payment
addresseswith the samespending authority. A group of such addresses shares the samefull viewing keyand
incoming viewing key, and so creating as many unlinkable addresses as needed does not increase the cost of
scanning theblock chainfor relevanttransactions.
Note:It is conventional in cryptography to call the key used to encrypt a message in an asymmetric encryption
scheme a “public key” . However, thepublic keyused as thetransmission keycomponent of an address ( pkenc or pkd)
need not be publically distributed; it has the same distribution as theshielded payment addressitself. As mentioned
above, limiting the distribution of theshielded payment addressis important for some use cases. This also helps
to reduce reliance of the overall protocol on the security of the cryptosystem used fornoteencryption (see §4.19
‘In-band secret distribution (Sprout)’ on p. 68 and §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on
p. 70), since an adversary would have to know pkenc or some pkd in order to exploit a hypothetical weakness in that
cryptosystem.
3.2 Shielded Pools and Notes #notes
Anoteis a representation of value held in ashielded pool.
Eachshielded pooloperates according to the rules of ashielded protocol, and has its owntreestate(see §3.4
‘Transactions and Treestates’ on p. 19). The currently deployedshielded poolsare the Sprout pool and Sapling pool
andOrchard pool.
Eachnote(denoted n) belongs to one of theseshielded pools. It represents that a value v is spendable by the
recipient who holds thespending keycorresponding to a givenshielded payment address. The form of ashielded
payment addressis defined by ashielded protocol; it can be used to send funds represented by newnotesto the
address, in theshielded pool(s)supported by that protocol.
LetMAX_MONEY,ℓ SproutPRF ,ℓ PRFnfSapling,ℓ d, andℓ value be as defined in §5.3 ‘Constants’ on p.77.
LetNoteCommit Sprout be as defined in §5.4.8.1 ‘Note Commitments (Sprout)’ on p.98.
LetNoteCommit Sapling be as defined in §5.4.8.2 ‘Windowed Pedersen commitments’ on p.99.
LetKA Sapling be as defined in §5.4.5.3 ‘Sapling Key Agreement’ on p.92.
Let DiversifyHashSapling be as defined in §5.4.1.6 ‘DiversifyHashSapling andDiversifyHash Orchard Hash Functions’ on p. 81.
LetNoteCommit Orchard be as defined in §5.4.8.4 ‘Sinsemilla commitments’ on p.101.
LetKA Orchard be as defined in §5.4.5.5 ‘Orchard Key Agreement’ on p.93.
Let DiversifyHashOrchardbe as defined in §5.4.1.6 ‘DiversifyHashSapling andDiversifyHash Orchard Hash Functions’ on p. 81.
LetPRF nfOrchard be as defined in §5.4.2 ‘Pseudo Random Functions’ on p.89.
Let𝑞 P be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108.
15
ASprout-poolnoteis a tuple(a pk,v,ρ,rcm), where:
•a pk B[ℓSproutPRF ] is thepaying keyof the recipient’sshielded payment address;
•v {0..MAX_MONEY}is an integer representing the value of thenoteinzatoshi(1ZEC= 108 zatoshi);
•ρ B[ℓSproutPRF ] is used as input toPRF nfSproutask to derive thenullifierof thenote;
•rcm NoteCommitSprout.Trapdoor is a randomcommitment trapdooras defined in §4.1.8 ‘Commitment’ on
p.32.
LetNote Sprout be the type of aSprout-poolnote, i.e.
NoteSprout :=B [ℓSproutPRF ]×{0..MAX_MONEY}×B [ℓSproutPRF ]×NoteCommit Sprout.Trapdoor.
ASapling-poolnoteis a tuple(d,pk d,v,rcm), where:
•d B[ℓd] is thediversifierof the recipient’sshielded payment address;
•pk d KASapling.PublicPrimeOrder is thediversified transmission keyof the recipient’sshielded payment address;
•v {0..MAX_MONEY}is an integer representing the value of thenoteinzatoshi;
•rcm NoteCommitSapling.Trapdoor is a randomcommitment trapdooras defined in §4.1.8 ‘Commitment’ on
p.32.
LetNote Sapling be the type of aSapling-poolnote, i.e.
NoteSapling :=B [ℓd]×KA Sapling.PublicPrimeOrder×{0..MAX_MONEY}×NoteCommit Sapling.Trapdoor.
AnOrchard-poolnoteis a tuple(d,pk d,v,ρ,ψ,rcm), where:
•d B[ℓd] is thediversifierof the recipient’sshielded payment address;
•pk d KAOrchard.PublicPrimeOrder is thediversified transmission keyof the recipient’sshielded payment address;
•v {0..2 ℓvalue−1}is an integer representing the value of thenoteinzatoshi;
•ρ F𝑞P is used as input toPRF nfOrchardnk as part of deriving thenullifierof thenote;
•ψ F𝑞P is additional randomness used in deriving thenullifier;
•rcm NoteCommitOrchard.Trapdoor is a randomcommitment trapdooras defined in §4.1.8 ‘Commitment’ on
p.32.
LetNote Orchard be the type of anOrchard-poolnote, i.e.
NoteOrchard :=B [ℓd]×KA Orchard.PublicPrimeOrder×{0..2 ℓvalue−1}×F 𝑞P×F 𝑞P×NoteCommit Orchard.Trapdoor.
Creation of newnotesis described in §4.7 ‘Sending Notes’ on p.46.
3.2.1 Note Plaintexts and Memo Fields #noteptconcept
Transmittednotesare stored on theblock chainin encrypted form, together with a representation of thenote
commitmentcmdescribed in §3.2.2 ‘Note Commitments’ on p.17.
Anote plaintextalso includes a 512-bytememo fieldassociated with thisnote. The usage of thememo fieldis by
agreement between the sender and recipient of thenote.RECOMMENDEDnon-consensus constraints on the
memo fieldcontents are specified in [ZIP-302].
For Sprout, thenote plaintextsin eachJoinSplit descriptionare encrypted to the respectivetransmission keys
pknewenc,1..Nnew, as specified in §4.7.1 ‘Sending Notes (Sprout)’ on p.46.
16
EachSprout-poolnote plaintext(denotednp) consists of
(leadByte BY Y,v {0..2 ℓvalue−1},ρ B[ℓSproutPRF ],rcm NoteCommitSprout.Trapdoor,memo BY Y[512]).
The field leadByte is always 0x00 for Sprout. The fields v, ρ, and rcm are as defined in §3.2 ‘Shielded Pools and Notes’
on p.15.
[ Sapling onward] For Saplingand Orchard, thenote plaintextin eachOutput descriptionorAction descriptionis
encrypted to thediversified payment address (d,pk d), as specified in §4.7.2 ‘Sending Notes (Sapling)’ on p. 47 or
§4.7.3 ‘Sending Notes (Orchard)’ on p.48.
EachSapling-poolorOrchard-poolnote plaintext(denotednp) consists of
(leadByte BY Y,d B[ℓd],v {0..2 ℓvalue−1},rseed BY Y[32],memo BY Y[512])
The field leadByte indicates the version of the encoding of thisnote plaintext. The allowed note plaintext lead bytes
differ based on theshielded poolandblock height, as described below.
Let the constantsCanopyActivationHeightandZIP212GracePeriodbe as defined in §5.3 ‘Constants’ on p.77.
Letpool {SaplingPool,OrchardPool}be thechain value poolof thenote.
Let height be theblock heightof theblockcontaining thetransactionhaving the encryptednote plaintextas an
output, and lettxVersionbe thetransaction version number.
DefineallowedLeadBytes pool(height,txVersion) :=⎧
⎪⎨
⎪⎩
{0x01},ifheight<CanopyActivationHeight
{0x01, 0x02},ifCanopyActivationHeight≤height<CanopyActivationHeight+ZIP212GracePeriod
{0x02},otherwise.
The leadByte of aSapling-pool or Orchard-poolnote plaintextMUSTsatisfy the condition leadByte∈allowedLeadBytes pool
(height,txVersion). SendersSHOULDchoose the highestleadByteallowed under this condition.
Non-normative notes:
• Since Orchardwas introduced after the end of the ZIP212GracePeriod,note plaintextsfor Orchard-pool notes
MUSThaveleadByte≥ 0x02.
• It is intentional that the definition of allowedLeadBytes does not currently depend on pool or txVersion. It might
do so in future.
The fieldsdandvare as defined in §3.2 ‘Shielded Pools and Notes’ on p.15.
The use of the fieldrseedis described in [ZIP-212].
Encodings are given in §5.5 ‘Encodings of Note Plaintexts and Memo Fields’ on p. 115. The result of encryption
forms part of atransmitted note(s) ciphertext. For further details, see §4.19 ‘In-band secret distribution (Sprout)’
on p.68 and §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p.70.
3.2.2 Note Commitments #notecommitmentconcept
When anoteis created as an output of atransaction, only a commitment (see §4.1.8 ‘Commitment’ on p. 32) to
thenotecontents is disclosed publically in the associatedJoinSplit descriptionorOutput descriptionorAction
description. If thetransactionis entered into theblock chain, each suchnote commitmentis appended to the
note commitment treeof the associatedtreestate. This allows the value and recipient to be kept private, while the
commitment is used by thezk-SNARK proofwhen thenoteis spent, to check that it exists on theblock chain.
Treestatesare described in §3.4 ‘Transactions and Treestates’ on p. 19, andnote commitment treesare described
in §3.8 ‘Note Commitment Trees’ on p.23.
17
ASprout-poolnote commitmenton anoten= (a pk,v,ρ,rcm)is computed as
NoteCommitmentSprout(n) =NoteCommit Sproutrcm (apk,v,ρ),
whereNoteCommit Sprout is instantiated in §5.4.8.1 ‘Note Commitments (Sprout)’ on p.98.
ASapling-poolnote commitmenton anoten= (d,pk d,v,rcm)is computed as
gd :=DiversifyHash Sapling(d)
NoteCommitmentSapling(n) :=
{︃
⊥,ifg d =⊥
NoteCommitSaplingrcm (reprJ(gd),repr J(pkd),v),otherwise.
whereNoteCommit Sapling is instantiated in §5.4.8.2 ‘Windowed Pedersen commitments’ on p.99.
Notice that the above definition of a Sapling-pool notedoes not have a ρ component. There is in fact a ρ value
associated with each Sapling-pool note, but this can only be computed once its position in thenote commitment
tree(see §3.4 ‘Transactions and Treestates’ on p. 19) is known. We refer to the combination of anoteand itsnote
positionpos, as apositioned note.
For apositioned note, we can compute the value ρ as described in §4.16 ‘Computingρvalues and Nullifiers’ on
p.60.
A Sapling-pool note commitmentis represented in anOutput descriptionby the 𝑢-coordinate of a Jubjub curve
point, as specified in §4.5 ‘Output Descriptions’ on p.43.
AnOrchard-poolnote commitmenton anoten= (d,pk d,v,ρ,ψ,rcm)is computed as
gd :=DiversifyHash Orchard(d)
NoteCommitmentOrchard(n) :=NoteCommit Orchardrcm (reprP(gd),repr P(pkd),v,ρ,ψ)
whereNoteCommit Orchard is instantiated in §5.4.8.4 ‘Sinsemilla commitments’ on p.101.
If NoteCommitOrchard returns⊥ (which happens with insignificant probability), thenoteis invalid and should be
recreated with a differentrseed.
Unlike in Sapling, the definition of an Orchard-pool noteincludes the ρ component; thenote’s position in thenote
commitment treedoes not need to be known in order to compute this value.
An Orchard-pool note commitmentis represented in anAction descriptionby the 𝑥-coordinate of a Pallas curve
point, as specified in §4.6 ‘Action Descriptions’ on p.44.
3.2.3 Nullifiers #nullifierconcept
Thenullifierfor anote, denoted nf, is a value unique to thenotethat is used to preventdouble-spends. When
atransactionthat contains one or moreJoinSplit descriptionsorSpend descriptionsorAction descriptionsis
entered into theblock chain, all of thenullifiersfornotesspent by thattransactionare added to thenullifier setof
the associatedtreestate. Atransactionis not valid if it would have added anullifierto thenullifier setthat already
exists in the set.
Treestatesare described in §3.4 ‘Transactions and Treestates’ on p. 19, andnullifier setsare described in §3.9
‘Nullifier Sets’ on p.23.
In more detail, when anoteis spent, the spender creates azero-knowledge proofthat it knows (ρ,a sk) or (ρ,ak,nsk)
or (ρ,ak,nk) , consistent with the publically disclosednullifierand some previously committednote commitment.
Because eachnotecan have only a singlenullifier, and the samenullifiervalue cannot appear more than once in a
valid block chain,double-spendingis prevented.
Thenullifierfor aSprout-poolnoteis derived from theρvalue and the recipient’sspending keya sk.
Thenullifierfor aSapling-poolnoteis derived from theρvalue and the recipient’snullifier deriving keynk.
18
Thenullifierfor an Orchard-pool noteis derived from the ρ and ψ values, the recipient’snullifier deriving key nk,
and thenote commitment.
Thenullifiercomputation uses aPseudo Random Function(see §4.1.2 ‘Pseudo Random Functions’ on p. 26), as
described in §4.16 ‘Computingρvalues and Nullifiers’ on p.60.
3.3 The Block Chain #blockchain
At a given point in time, eachfull validatoris aware of a set of candidateblocks. These form a tree rooted at the
genesis block, where each node in the tree refers to its parent via the hashPrevBlock block headerfield (see §7.6
‘Block Header Encoding and Consensus’ on p.137).
A path from the root toward the leaves of the tree consisting of a sequence of one or more validblocksconsistent
with consensus rules, is called avalid block chain.
Eachblockin ablock chainhas ablock height. Theblock heightof thegenesis blockis 0, and theblock heightof each
subsequentblockin theblock chainincrements by 1. ImplementationsMUSTsupportblock heightsup to and in-
cluding 231−1. As of NU5, there is a consensus rule that allcoinbase transactions(see §3.11 ‘Coinbase Transactions’
on p. 24) MUST have the nExpiryHeight field set to theblock height, and this limits the maximumblock heightto
232−1, absent future consensus changes.
In order to choose thebest valid block chainin its view of the overallblocktree, a node sums the work, as defined
in §7.7.5 ‘Definition of Work’ on p. 142, of allblocksin eachvalid block chain, and considers thevalid block chain
with greatest total work to be best. To break ties between leafblocks, a node will prefer theblockthat it received
first.
The consensus protocol is designed to ensure that for any givenblock height, the vast majority of well-connected
nodes should eventually agree on theirbest valid block chainup to that height. Afull validator 5 SHOULDattempt
to obtain candidateblocksfrom multiple sources in order to increase the likelihood that it will find avalid block
chainthat reflects a recent consensus state.
Anetwork upgradeissettledon a givennetworkwhen there is a social consensus that it has activated with a
givenactivation blockhash. Afull validatorthat potentially risksMainnetfunds or displaysMainnet transaction
information to a userMUSTdo so only for ablock chainthat includes theactivation blockof the most recentsettled
network upgrade, with the correspondingactivation blockhash. Currently, there is social consensus that NU6.2 has
activated on theZcashMainnetandTestnetwith theactivation blockhashes given in §3.12 ‘Mainnet and Testnet’
on p.24.
Afull validatorMAYimpose a limit on the number ofblocksit will “roll back” when switching from onebest valid
block chainto another that is not a descendent. For zcashd and zebra this limit is100blocks.
3.4 Transactions and Treestates #transactions
Eachblockcontains one or moretransact프로젝트로 돌아가기