bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 4쪽
ions.
Eachtransactionhas atransaction ID.Transaction IDsare used to refer totransactionsin tx_out fields, inleaf
nodesof ablock’stransactiontree rooted at hashMerkleRoot, and in other parts of the ecosystem; for example they
are shown inblock chainexplorers and can be used in higher-level protocols.Transaction version5 also have
awtxid, which is used instead of thetransaction IDwhen gossipingtransactionsin thepeer-to-peer protocol
[ZIP-239]. The computation oftransaction IDsandwtxidsis described in §7.1.1 ‘Transaction Identifiers’ on p. 128.
For more detail on the distinction between these two identifiers and when to use each of them, see [ZIP-239] and
[ZIP-244].
Transparent inputsto atransactioninsert value into atransparent transaction value poolassociated with the
transaction, andtransparent outputsremove value from this pool.
5 There is reason to follow the requirements in this section also for non-full validators, but those are outside the scope of this protocol
specification.
19
The effects of eachshielded protocolon thetransparent transaction value poolare described in the following
sections:
•Sprout-poolJoinSplit transfersin §4.18.1 ‘JoinSplit Statement (Sprout)’ on p.63;
•Sapling-pool Spend transfersandOutput transfersin §4.13 ‘Balance and Binding Signature (Sapling)’ on
p.55.
•Orchard-poolAction transfersin §4.14 ‘Balance and Binding Signature (Orchard)’ on p.57.
As inBitcoin, the remaining value in thetransparent transaction value poolof a non-coinbasetransactionis
available to miners as atransaction fee. That is, the sum of those values for non-coinbasetransactionsin eachblock
is treated as an implicit input to thetransparent transaction value poolbalance of theblock’scoinbase transaction
(in addition to the implicit input created by issuance).
The remaining value in thetransparent transaction value poolofcoinbase transactionsinblocksprior to NU6
is destroyed. From NU6, this remaining value is required to be zero; that is, all of the available balanceMUSTbe
consumed by outputs of thecoinbase transaction.
Consensus rule:The remaining value in thetransparent transaction value poolMUSTbe nonnegative.
To eachtransactionthere are associated initialtreestatesfor the Sprout pool and Sapling pool and Orchard pool. Each
treestateconsists of:
•anote commitment tree( §3.8 ‘Note Commitment Trees’ on p.23);
•anullifier set( §3.9 ‘Nullifier Sets’ on p.23).
Validation state associated withtransparentinputs and outputs, such as theUTXO (unspent transaction output) set,
is not described in this document; it is used in essentially the same way as inBitcoin.
Ananchoris a Merkle tree root of one of thesenote commitment trees. It uniquely identifies anote commitment
treestate given the assumed security properties of the Merkle tree’shash function. Since thenullifier setis always
updated together with thenote commitment tree, this also identifies a particular state of the associatednullifier set.
In a givenblock chain, for each of the Sprout pool and Sapling pool and Orchard pool,treestatesare chained as follows:
•The inputtreestateof the firstblockis the emptytreestate.
• The inputtreestateof the firsttransactionof ablockis the finaltreestateof the immediately precedingblock.
• The inputtreestateof each subsequenttransactionin ablockis the outputtreestateof the immediately
precedingtransaction.
•The finaltreestateof ablockis the outputtreestateof its lasttransaction.
JoinSplit descriptionsalso have interstitial input and outputtreestatesfor the Sprout pool, explained in the following
section. There is no equivalent of interstitialtreestatesfor theSapling poolnor theOrchard pool.
3.5 JoinSplit Transfers and Descriptions #joinsplit
AJoinSplit descriptionis data included in atransactionthat describes aJoinSplit transfer, i.e. ashieldedvalue
transfer. In Sprout, this kind of value transfer was the primaryZcash-specific operation performed bytransactions.
AJoinSplit transferspends Nold notes nold1..Nold andtransparent input voldpub, and creates Nnew notes nnew1..Nnew and
transparent output vnewpub . It is associated with aJoinSplit statementinstance ( §4.18.1 ‘JoinSplit Statement (Sprout)’
on p.63), for which it provides azk-SNARK proof.
Eachtransactionhas a sequence ofJoinSplit descriptions.
The total vnewpub value adds to, and the total voldpub value subtracts from thetransparent transaction value poolof the
containingtransaction.
20
Theanchorof eachJoinSplit descriptionin atransactionrefers to aSprout-pooltreestate.
For each of the Nold shielded inputs, anullifieris revealed. This allows detection ofdouble-spendsas described in
§3.9 ‘Nullifier Sets’ on p.23.
For eachJoinSplit descriptionin atransaction, an interstitial outputtreestateis constructed which adds thenote
commitmentsandnullifiersspecified in thatJoinSplit descriptionto the inputtreestatereferred to by itsanchor.
This interstitial outputtreestateis available for use as theanchorof subsequentJoinSplit descriptionsin the same
transaction. In general, therefore, the set of interstitialtreestatesassociated with atransactionforms a tree in which
the parent of each node is determined by itsanchor.
Interstitialtreestatesare necessary because when atransactionis constructed, it is not known where it will
eventually appear in a minedblock. Therefore theanchorsthat it uses must be independent of its eventual position.
The input and output values of eachJoinSplit transferMUSTbalance exactly. This is not a consensus rule since it
cannot be checked directly; it is enforced by theBalancerule of theJoinSplit statement.
Consensus rules:
• For the firstJoinSplit descriptionof atransaction, theanchorMUSTbe the output Sprout-pool treestateof a
previousblock.
• Theanchorof eachJoinSplit descriptionin atransactionMUSTrefer to either some earlierblock’s final Sprout-
pool treestate, or to the interstitial outputtreestateof any priorJoinSplit descriptionin the sametransaction.
3.6 Spend Transfers, Output Transfers, and their Descriptions #spendsandoutputs
JoinSplit transfersare not used for Sapling-pool notes. Instead, there is a separateSpend transferfor eachshielded
input, and a separateOutput transferfor eachshielded output.
Spend descriptionsandOutput descriptionsare data included in atransactionthat describeSpend transfersand
Output transfers, respectively.
ASpend transferspends anote nold. ItsSpend descriptionincludes aPedersen value commitmentto the value of
thenote. It is associated with an instance of aSpend statement( §4.18.2 ‘Spend Statement (Sapling)’ on p. 64) for
which it provides azk-SNARK proof.
AnOutput transfercreates anote nnew. Similarly, itsOutput descriptionincludes aPedersen value commitmentto
thenotevalue. It is associated with an instance of anOutput statement( §4.18.3 ‘Output Statement (Sapling)’ on
p.65) for which it provides azk-SNARK proof.
Eachtransactionhas a sequence ofSpend descriptionsand a sequence ofOutput descriptions.
To ensure balance, we use a homomorphic property ofPedersen commitmentsthat allows them to be added
and subtracted, as elliptic curve points ( §5.4.8.3 ‘Homomorphic Pedersen commitments (Sapling and Orchard)’ on
p. 99). The result of adding twoPedersen value commitments, committing to values v1 and v2, is a newPedersen
value commitmentthat commits tov 1 +v 2. Subtraction works similarly.
Therefore, balance can be enforced by adding all of thevalue commitmentsforshielded inputs, subtracting all of
thevalue commitmentsforshielded outputs, and proving by use of aSapling binding signature(as described in
§4.13 ‘Balance and Binding Signature (Sapling)’ on p. 55) that the result commits to a value consistent with the
nettransparentvalue change. This approach allows all of thezk-SNARK statementsto be independent of each
other, potentially increasing opportunities for precomputation.
ASpend descriptionspecifies ananchor, which refers to the output Sapling-pool treestateof a previousblock. It
also reveals anullifier, which allows detection ofdouble-spendsas described in §3.2.3 ‘Nullifiers’ on p.18.
Non-normative note:Interstitialtreestatesare not necessary for Sapling, because aSpend transferin a given
transactioncannot spend any of theshielded outputsof the sametransaction. This is not an onerous restriction
because, unlike Sproutwhere eachJoinSplit transfermust balance individually, in Saplingit is only necessary for the
wholetransactionto balance.
21
Consensus rules:
• TheSpend transfersandAction transfersof atransactionMUSTbe consistent with its vSaplingPoolBalance value as
specified in §4.13 ‘Balance and Binding Signature (Sapling)’ on p.55.
• Theanchorof eachSpend descriptionMUSTrefer to some earlierblock’s final Sapling-pool treestate. The
anchoris encoded separately in eachSpend descriptionfor v4transactions, or encoded once and shared
between allSpend descriptionsin a v5transaction.
3.7 Action Transfers and their Descriptions #actions
OrchardintroducesAction transfers, each of which can optionally perform a spend, and optionally perform an
output.
Action descriptionsare data included in atransactionthat describeAction transfers.
AnAction transferspends anote nold, and creates anote nnew. ItsAction descriptionincludes aPedersen value
commitmentto the net value, i.e. the value of the spentnoteminus the value of the creatednote. It is associated
with an instance of anAction statement( §4.18.4 ‘Action Statement (Orchard)’ on p. 66) for which it provides a
zk-SNARK proof.
Each version 5transactionhas a sequence ofAction descriptionsfor the Orchard pool. Version 4transactions
cannot containAction descriptions.
As in Sapling, we use the homomorphic property ofPedersen commitmentsto enforce balance: we add all of the
value commitmentsand prove by use of anOrchard binding signaturethat the result commits to a value consistent
with the nettransparentvalue change (as described in §4.14 ‘Balance and Binding Signature (Orchard)’ on p. 57).
This approach allows all of thezk-SNARK statementsto be independent of each other, potentially increasing
opportunities for precomputation.
The fields of anAction descriptionare essentially a merger of the fields of aSpend descriptionand anOutput
description, but with only a singlevalue commitment. Also, thezk-SNARK proofis encoded outside theAction
description, in order to more easily take advantage of space and performance optimizations in the Halo 2 proof
system ( §5.4.10.3 ‘Halo 2’ on p. 115) that apply when multiple proofs are aggregated. EachAction descriptiondoes
not encode a separateanchorfield, because that is encoded once in the anchorOrchard field of thetransaction.
Non-normative note:As with Sapling, interstitialtreestatesare not necessary for Orchard, because anAction
transferin a giventransactioncannot spend any of theshielded outputsof the sametransaction.
Consensus rules:
• The Orchard-pool Action transfersof atransactionMUSTbe consistent with its vOrchardPoolBalance value as specified
in §4.14 ‘Balance and Binding Signature (Orchard)’ on p.57.
• The anchorOrchard field of thetransaction, whenever it exists (i.e. when there are any Orchard-pool Action
descriptions),MUSTrefer to some earlierblock’s finalOrchard-pooltreestate.
22
3.8 Note Commitment Trees #notecommitmenttrees
Let ℓSproutMerkle, MerkleDepthSprout, ℓSaplingMerkle , MerkleDepthSapling, ℓOrchardMerkle , andMerkleDepthOrchardbe as defined in §5.3 ‘Constants’
on p.77.
Anote commitment treeis anincremental Merkle tree, of fixed depth defined by eachshielded protocol, used to
storenote commitmentsthatJoinSplit transfersorSpend transfersorAction transfersproduce. Just as theUTXO
(unspent transaction output) setused inBitcoin, it is used to express the existence of value and the capability to
spend it. However, unlike theUTXO set, it is not the job of this tree to protect againstdouble-spending, as it is
append-only.
Arootof anote commitment treeis associated with thetreestate( §3.4 ‘Transactions and Treestates’ on p. 19) for
eachshielded pool.
Eachnodein theincremental Merkle treeis associated with ahash valueof size ℓSproutMerkle or ℓSaplingMerkle or ℓOrchardMerkle bits. The
layernumbered ℎ, counting fromlayer 0 at theroot, has 2ℎ nodeswithindices 0 to 2ℎ−1 inclusive. Thehash value
associated with thenodeatindex𝑖inlayerℎis denotedM ℎ𝑖 .
Theindexof anote’s commitmentat the leafmost layer ( MerkleDepthSprout or MerkleDepthSapling or MerkleDepthOrchard)
is called itsnote position.
Consensus rules:
• AblockMUST NOTadd Sprout-pool note commitmentsthat would result in the Sprout-pool note commitment
treeexceeding its capacity of2 MerkleDepthSprout leaf nodes.
• [ Sapling onward] AblockMUST NOTadd Sapling-pool note commitmentsthat would result in the Sapling-pool
note commitment treeexceeding its capacity of2 MerkleDepthSapling leaf nodes.
• [ NU5 onward] AblockMUST NOTadd Orchard-pool note commitmentsthat would result in the Orchard-pool
note commitment treeexceeding its capacity of2 MerkleDepthOrchard leaf nodes.
3.9 Nullifier Sets #nullifierset
Eachfull validatormaintains anullifier setlogically associated with thetreestatefor eachshielded pool. As valid
transactionscontainingJoinSplit transfersorSpend transfersorAction transfersare processed, thenullifiers
revealed inJoinSplit descriptionsandSpend descriptionsandAction descriptionsare inserted into thenullifier
setassociated with the newtreestate.Nullifiersare enforced to be unique within avalid block chain, in order to
preventdouble-spends.
Consensus rule:AnullifierMUST NOTrepeat either within atransaction, or acrosstransactionsin avalid block
chain. Sprout-pool and Sapling pool and Orchard pool nullifiersare considered disjoint, even if they have the same bit
pattern.
23
3.10 Block Subsidy, Funding Streams, and Founders’ Reward #subsidyconcepts
LikeBitcoin,Zcashcreates currency whenblocksare mined. The value created on mining ablockis called the
block subsidy.
[Pre-Canopy] Theblock subsidyis composed of aminer subsidyand aFounders’ Reward.
[Canopyonward] Theblock subsidyis composed of aminer subsidyand a series offunding streams.
As inBitcoin, the miner of ablockalso receivestransaction fees.
The calculations of theblock subsidy,miner subsidy,Founders’ Reward, andfunding streamsdepend on theblock
height, as defined in §3.3 ‘The Block Chain’ on p.19.
§7.8 ‘Calculating Block Subsidy, Funding Streams, Lockbox Disbursement, and Founders’ Reward’on p.142
describes these calculations.
3.11 Coinbase Transactions #coinbasetransactions
Atransactionthat has a singletransparent inputwith a null prevout field, is called acoinbase transaction. Every
blockhas a singlecoinbase transactionas the firsttransactionin theblock. The purpose of thiscoinbase transaction
is to collect and spend anyminer subsidy, andtransaction feespaid by othertransactionsincluded in theblock.
[Pre-Canopy] §7.9 ‘Payment of Founders’ Reward’ on p. 143 specifies that thecoinbase transactionMUSTalso
pay theFounders’ Reward.
[Canopyonward] §7.10 ‘Payment of Funding Streams, Deferred Lockbox, and Lockbox Disbursement’ on p. 145
specifies that thecoinbase transactionMUSTalso pay thefunding streams.
3.12 Mainnet and Testnet #networks
The productionZcashnetwork, which supports theZECtoken, is calledMainnet. Governance of its protocol
is by social consensus on whichfull validatorimplementations are considered to be faithful implementations
of the intendedMainnetconsensus rules, and on how those implementations should be modified. Currently
these implementations are zebra maintained by the Zcash Foundation, andzcashd maintained by the Zcash Open
Development Lab.
Subject to errors and omissions, each version of this document intends to describe some version (or planned
version) of theZcashprotocol.
Allblock hashesgiven in this section are inRPC byte order(that is, byte-reversed relative to the normal order for a
SHA-256hash).
Mainnet genesis block: 00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce08
Mainnet NU6.2activation block: 0000000000806344c408a4cfdf472f4132c632edbdc24cf2f3f672061da8b865
There is also a public testnetworkcalledTestnet. It supports aTAZtoken which is intended to have no monetary
value. By convention,Testnetnormally activatesnetwork upgrades(as described in §6 ‘Network Upgrades’ on
p. 124) beforeMainnet, in order to allow for errors or ambiguities in their specification and implementation to be
discovered. TheTestnet block chainis subject to being rolled back to a priorblockat any time.
Testnet genesis block: 05a60a92d99d85997cce3b87616c089f6124d7342af37106edc76126334a2c38
Testnet NU6.2activation block: 0010cb912b0188da5bc055ee67e3f77d30cd27611369d865974a5bf0b1ec2912
We call the smallest units of currency (on eithernetwork)zatoshi. 6
OnMainnet,1ZEC= 108 zatoshi. OnTestnet,1TAZ= 108 zatoshi.
Othernetworksusing variants of theZcashprotocol may exist, but are not described by this specification.
6 “tazoshi” may be used for the smallest units of currency on Testnet, but it is usually more convenient to use anetwork-independent term.
24
4 Abstract Protocol #abstractprotocol
‘We all know that the only mental tool by means of which a very finite piece of reasoning
can cover a myriad cases is called “abstraction”; as a result the effective exploitation of
[their] powers of abstraction must be regarded as one of the most vital activities of a
competent programmer. In this connection it might be worth-while to point out that the
purpose of abstracting is not not not notto be vague, but to create a new semantic level in which
one can be absolutely precise.’
— Edsger Dijkstra, “The Humble Programmer” [EWD-340]
Abstraction is an incredibly important idea in the design of any complex system. Without abstraction, we would
not be able to design anything as ambitious as a computer, or a cryptographic protocol. Were we to attempt it, the
computer would be hopelessly unreliable or the protocol would be insecure, if they could be completed at all.
The aim of abstraction is primarily to limit how much a human working on a piece of a system has to keep in mind
at one time, in order to apprehend the connections of that piece to the remainder. The work could be to extend or
maintain the system, to understand its security or other properties, or to explain it to others.
In this specification, we make use wherever possible of abstractions developed by the cryptography community to
model cryptographic primitives:Pseudo Random Functions,commitment schemes,signature schemes, etc. Each
abstract primitive has associated syntax (its interface as used by the rest of the system) and security properties, as
documented in this part. Their instantiations are documented in part §5 ‘Concrete Protocol’ on p.76.
In some cases this syntax or these security requirements have been extended to meet the needs of theZcash
protocol. For example, some of the PRFs used inZcashneed to becollision-resistant, which is not part of the usual
security requirement for a PRF; somesignature schemesneed to support additional functionality and security
properties; and so on. Also, security requirements are sometimes intentionally stronger than what is known to be
needed, because the stronger property is simpler or less error-prone to work with, and/or because it has been
studied in the cryptographic literature in more depth.
We explicitly do not claim, however, that all of these instantiations satisfying their documented syntax and security
requirements would be sufficient for security or correctness of the overallZcashprotocol, or that it is always
necessary. The claim is only that it helps to understand the protocol; that is, that analysis or extension is simplified by
making use of the abstraction. In other words, a good way to understand the use of that primitive in the protocol
is to model it as an instance of the given abstraction. And furthermore, if the instantiated primitive does not in fact
satisfy the requirements of the abstraction, then this is an error that should be corrected –whether or not it leads to
a vulnerability– since that would compromi프로젝트로 돌아가기