ZIP: unassigned
Title: Air drops, Proof-of-Balance, and Stake-weighted Polling
Owners: Daira-Emma Hopwood <daira@electriccoin.co>
Jack Grigg <jack@electriccoin.co>
Status: Draft
Category: Informational
Created: 2023-12-07
License: MIT
Terminology 
The key words “MUST”, “MUST NOT”, and “MAY” in this document are to be
interpreted as described in BCP 14 (1)_ when, and only when, they appear in
all capitals.
“Pool snapshot” refers to a snapshot of the state of balances in a shielded pool
as of the end of a specified block.
“Claim” refers to a proof by a ZEC holder (TODO: support ZSAs) that they held a
set of notes summing to a committed value at the time of a given pool snapshot.
Abstract 
This ZIP specifies a mechanism that effectively takes a snapshot of the state of
shielded balances in the Orchard pool, and allows holders to prove that they had
at least a given balance as of the snapshot, in such a way that they cannot claim
the same balance more than once. The privacy of holders is retained, in the sense
that claims cannot be linked to their past or future spends.
Possible applications include private air drops, private proof-of-balance, and
private stake-weighted polling.
Motivation 
TODO: Explain why this can’t be done more simply, and how the problem is
isomorphic to air-drops and stake-weighted polling.
Do we need to be able to construct a note in another token corresponding to the
claimed value? Can that be done just with the existing ZSA spec + a public value
commitment?
Requirements 
Who is eligible to vote / claim an airdrop?
- Most likely approach: snapshot the Zcash chain at some height. Eligible notes
exist in the commitment tree at that height, but don’t exist in the nullifier
set at that height.
Does the Zcash side need to prove spend authority?
- Yes, it does (otherwise if people gave out their viewing keys to others, those
others could vote / claim the airdrop instead).
- UX effect: anyone who moved their funds to a different spend authority after
the snapshot and then lost their old spending keys become unable to vote /
claim the airdrop.
Specification 
Sketch:
A “nullifier non-membership tree” is a Merkle tree of sorted disjoint
(start, end) pairs representing the gaps between revealed nullifiers at a pool
snapshot. That is, the union of the regions start..=end is exactly the
complement of the set of revealed nullifiers at the snapshot.
An “alternate nullifier” is a value derived from a note, with similar
cryptographic properties to its standard nullifier, but including a “nullifier
domain” as input to the derivation. It is distinct from and unlinkable with the
standard nullifier, or any of the other alternate nullifiers for that note in
other nullifier domains. A note has exactly one alternate nullifier for each
nullifier domain.
An entity that wants to conduct an air-drop, stake-weighted poll, etc. does the
following:
- Choose a pool snapshot at a particular block height.
- Choose a previously unused nullifier domain dom.
- > TODO: how to ensure it is previously unused? What are the consequences if it isn’t?
- Maybe the domain is derived from the pool snapshot and a string identifying
the air-drop/poll? Then a wallet that supports this protocol can display the
string and the block height/date of the snapshot to the wallet user.
- Deterministically construct a nullifier non-membership tree as of the snapshot,
with root rtexcl. Anyone can check that this root is correct using
public information.
- Keep track of a set of alternate nullifiers revealed by the statement below and
make sure that they don’t repeat.
To participate, a holder proves the following informal statement:
"Given:
- a value commitment cv;
- a nullifier domain dom;
- an alternate nullifier nfdom;
- a pool snapshot (rtcm,rtexcl);
I am the holder of a note n that is unspent at pool snapshot
(rtcm,rtexcl), such that n has value
commitment cv and alternate nullifier nfdom in
nullifier domain dom."
Another possible approach 
Have the holder actually spend the claimed notes (e.g. to themself) with an
anchor at the pool snapshot. This has the disadvantage that they cannot
participate in concurrent polls/air-drops.
Alternate nullifier derivation 
Given a nullifier domain dom and an Orchard note
n=(dold,pkdold,vold,ρold,φold,rcmold)
with note commitment cmold, the alternate nullifier nfdom
for n is computed as:
nfdom!!!=!!!DeriveAlternateNullifiernk(ρold,φold,cmold,dom) !!!=!!!ExtractP([(PRFnknfAlternate(ρold,dom)+φ)modqP],KOrchard+cmold)
Here PRFnfAlternate is another instantiation of Poseidon. In order
for dom to be an arbitrary field element without any loss of security,
it would have to use an instantiation of Poseidon with a 4-element to 4-element
permutation.
TODO: security analysis, in particular for collision attacks and for linkability across domains.
Rationale for not using a similar nullifier derivation to ZSA split notes 
The nullifier derivation in draft ZIP 226 for ZSA split notes is:
nf=ExtractP([(PRFnknfOrchard(ρold)+φ′)modqP],KOrchard+cmold+LOrchard) This fails to do what we want in two ways:
- It is nondeterministic, due to the random φ′.
- If φ′ were required to be φold and
LOrchard were replaced by a hash-to-curve of
dom, then nullifiers for different domains (including the original
ZEC domain) would be linkable, since they would differ by a predictable point.
(There are two possible points corresponding to a given nullifier, but this is
only a trivial obstable to linking them.)
Making a claim 
For each note that the holder wants to claim, they prove an instance of the
circuit below, and provide this proof together with a spend authorization
signature (constructed as though they were spending the note).
It is easy to add up value commitments and then open them if desired, or use them in another zk proof.
Can we make it more efficient to claim that you hold multiple notes?
Circuit 
A valid instance of a Claim statement, π, assures that given a primary input:
- cv⦂ValueCommitOrchard.Output
- dom⦂{0..qP−1}
- nfdom⦂{0..qP−1}
- rk⦂SpendAuthSigOrchard.Public
the prover knows an auxiliary input:
- path⦂{0..qP−1}[MerkleDepthOrchard]
- pos⦂{0..2MerkleDepthOrchard−1}
- gdold⦂P∗
- pkdold⦂P∗
- vold⦂{0..2ℓvalue−1}
- ρold⦂FqP
- φold⦂FqP
- rcmold⦂{0..2ℓscalarOrchard−1}
- cmold⦂P
- nfold⦂{0..qP−1}
- α⦂{0..2ℓscalarOrchard−1}
- akP⦂P∗
- nk⦂FqP
- rivk⦂Commitivk.Trapdoor
- rcv⦂{0..2ℓscalarOrchard−1}
- pathexcl⦂{0..qP−1}[MerkleDepthexcl]
- posexcl⦂{0..2MerkleDepthexcl−1}
- start⦂{0..2MerkleDepthOrchard−1}
- end⦂{0..2MerkleDepthOrchard−1}
such that the following conditions hold:
Note commitment integrity NoteCommitrcmoldOrchard(reprP(gdold),reprP(pkdold),vold,ρold,φold)∈{cmold,⊥}.
Merkle path validity for cmold(pathcm,poscm) is a valid Merkle path of depth MerkleDepthOrchard, as defined in § 4.9 ‘Merkle Path Validity’, from cmold to the anchor rtcm.
Value commitment integrity cv=ValueCommitrcvOrchard(vold).
Nullifier integrity nfold=DeriveNullifiernk(ρold,φold,cmold).
Spend authority rk=SpendAuthSigOrchard.RandomizePublic(α,akP).
Diversified address integrity ivk=⊥ or pkdold=[ivk]gdold where ivk=Commitrivkivk(ExtractP(akP),nk).
Merkle path validity for (start,end)(pathexcl,posexcl) is a valid Merkle path of depth MerkleDepthexcl, as defined in § 4.9 ‘Merkle Path Validity’, from excl to the anchor rtexcl, where excl=MerkleCRHOrchard(MerkleDepthexcl,start,end).
Nullifier in excluded range start≤nfold≤end.
Alternate nullifier integrity nfdom=DeriveAlternateNullifiernk(ρold,φold,cmold,dom).
Circuit implementation 
All of these but the last three checks are identical to the corresponding parts
of an Action statement.
Merkle path validity for (start,end) is almost identical
to the other Merkle path validity check.
Alternate nullifier integrity is probably very similar to Nullifier integrity.
Nullifier in excluded range is fairly straightforward. Nullifiers are
arbitrary field elements so be careful of overflow. Since we can check outside
the circuit that start≤end, the check becomes
equivalent to 0≤nfold−start≤end−start.
Rationale 
TODO
References 
-
Information on BCP 14 — “RFC 2119: Key words for use in RFCs to Indicate Requirement Levels” and “RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words” https://www.rfc-editor.org/info/bcp14
(2) Zcash Protocol Specification, Version 2023.4.0 or later <protocol/protocol.pdf> ↩︎
-
protocol ↩︎