11# Transaction Overview
22
3+ On this page we overview different pieces of data that are involved in a
4+ transaction, and the invariant conditions on that data that the transactions
5+ maintain.
6+
37As mentioned in [ Overview] ( overview ) , ZeroPool encodes all possible actions a
48user may want to perform on the pool with a single transaction type. A ZeroPool
59transaction consumes one account (associated with user's spending key $\sigma$)
@@ -9,9 +13,6 @@ old one) and `OUTPUT` number of new notes. The created new notes may belong to
913accounts of other users (with keys different from $\sigma$). Consumed account
1014and notes can not be used again.
1115
12- There may exist no more than one account associated with a given spending key
13- $\sigma$ at any single moment.
14-
1516::: tip
1617
1718Since the consumed and newly created account have the same associated
@@ -169,18 +170,21 @@ meaning in ZeroPool.
169170
170171### Nullifiers
171172
172- Nullifiers are special values that are unique for each pair of account + its
173- corresponding intermediate key $\eta$, which don't reveal the data of that
174- account and key. In practice, it's simply the hash of the account (all the
175- fields in its structure), accounts index in the sequence, and the intermediate
176- key $\eta$ that the transaction is being invoked with,
173+ Nullifiers are special hash values that are computed based on account's data
174+ and its corresponding intermediate key $\eta$. An account's nullifier uniquely
175+ identifies the account — yet it doesn't reveal the data of that account or its
176+ key.
177+
178+ More concretely, an account's nullifier is a hash of the account structure (all
179+ the fields in it), account's index in the sequence, and the intermediate key
180+ $\eta$ that the transaction is being invoked with,
177181
178182$$
179183\textsf{nullifier} = H(\textsf{account}, \textsf{index}, \eta).
180184$$
181185
182- For each transaction, the user publishes the nullifier of the account that
183- serves as input to this transaction. The ZeroPool smart-contract keeps the
186+ When submitting a transaction, the user publishes the nullifier of the account
187+ that serves as input to this transaction. The ZeroPool smart-contract keeps the
184188global history of all nullifiers it had seen, and rejects the transaction if
185189its corresponding nullifier was already recorded. This way, we make sure that
186190no account can serve as input to a transaction more than once.
@@ -224,8 +228,8 @@ incrementally append values to it.
224228
225229Consider a Merkle Tree of height $h$. To store the sequence $s_0, s_1 \dots
226230s_ {n-1}$ of accounts and notes in it, we assign first (going from left to
227- right) $n$ leaves of the tree hashes $H(s_0), H(s_1) \dots H(s_ {n-1})$ and fill
228- the remaining $2^h - n$ leaves with zeroes. And we compute the values of all
231+ right) $n$ leaves of the tree hashes $H(s_0), H(s_1) \dots H(s_ {n-1})$ and
232+ fill the remaining $2^h - n$ leaves with zeroes. We compute the values of all
229233inner nodes according to the usual Merkle Tree rule. (If no transactions have
230234happened yet and the sequence is empty, all leaves of the Merkle Tree will be
231235initialized with zeroes.)
@@ -237,17 +241,17 @@ $k$ into $h$ bits and treat $0$s and $1$s in it as a sequence of "left" and
237241recompute the Merkle Tree if some leaf is modified, or even multiple leaves in
238242bulk by updating a subtree. We've covered this in [ Background] ( background ) .
239243
240- Even though Merkle Tree allows modifying any leaf, including the ones we've
241- assigned before, we only use this functionality to append values to the
244+ Even though Merkle Tree allows modifying any leaf ( including the ones we've
245+ assigned before) , we only use this functionality to append values to the
242246sequence and never modify elements that were added to it before. Say, if the
243247Merkle Tree leaves currently currently have values
244248
245249$$
246250H(s_0), H(s_1) \dots H(s_{n-1}), 0, 0 \dots 0
247251$$
248252
249- assigned to them, the only modification we will do is assigning value
250- $H(s _ {n})$ to leaf $n $.
253+ assigned to them, the only modification we will do is overwriting the $0$ in
254+ leaf $n$ with value $H(s _ {n}) $.
251255
252256Using Merkle Tree commitment to implement a sequence of accounts and notes in
253257ZeroPool means that the total length of the sequence can never exceed $2^h$.
0 commit comments