Daira Emma Hopwood
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    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 [BCP14] 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 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 $\mathsf{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 $\mathsf{rt^{excl}}$. 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 $\mathsf{cv}$; * a nullifier domain $\mathsf{dom}$; * an alternate nullifier $\mathsf{nf_{dom}}$; * a pool snapshot $(\mathsf{rt^{cm}}, \mathsf{rt^{excl}})$; I am the holder of a note $\mathbf{n}$ that is unspent at pool snapshot $(\mathsf{rt^{cm}}, \mathsf{rt^{excl}})$, such that $\mathbf{n}$ has value commitment $\mathsf{cv}$ and alternate nullifier $\mathsf{nf_{dom}}$ in nullifier domain $\mathsf{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 $\mathsf{dom}$ and an Orchard note $\mathbf{n} = (\mathsf{d^{old}}, \mathsf{pk_d^{old}}, \mathsf{v^{old}}, \text{ρ}^{\mathsf{old}}, \text{φ}^{\mathsf{old}}, \mathsf{rcm^{old}})$ with note commitment $\mathsf{cm^{old}}$, the alternate nullifier $\mathsf{nf_{dom}}$ for $\mathbf{n}$ is computed as: $$ \begin{array}{rcl} \mathsf{nf_{dom}} &\!\!\!=\!\!\!& \mathsf{DeriveAlternateNullifier_{nk}}(\text{ρ}^{\mathsf{old}}, \text{φ}^{\mathsf{old}}, \mathsf{cm^{old}}, \mathsf{dom}) \\ &\!\!\!=\!\!\!& \mathsf{Extract}_{\mathbb{P}}\big(\big[(\mathsf{PRF^{nfAlternate}_{nk}} (\text{ρ}^{\mathsf{old}}, \mathsf{dom}) + \text{φ}) \bmod q_{\mathbb{P}}\big]\, \mathcal{K}^\mathsf{Orchard} + \mathsf{cm^{old}}\big) \end{array} $$ Here $\mathsf{PRF^{nfAlternate}}$ is another instantiation of Poseidon. In order for $\mathsf{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.== :::spoiler Rationale for not using a similar nullifier derivation to ZSA split notes :::info The nullifier derivation in draft ZIP 226 for ZSA split notes is: $$ \mathsf{nf} = \mathsf{Extract}_{\mathbb{P}}\big(\big[(\mathsf{PRF^{nfOrchard}_{nk}} (\text{ρ}^{\mathsf{old}}) + \text{φ}') \bmod q_{\mathbb{P}}\big]\, \mathcal{K}^\mathsf{Orchard} + \mathsf{cm^{old}} + \mathcal{L}^\mathsf{Orchard}\big) $$ This fails to do what we want in two ways: * It is nondeterministic, due to the random $\text{φ}'$. * If $\text{φ}'$ were required to be $\text{φ}^{\mathsf{old}}$ and $\mathcal{L}^\mathsf{Orchard}$ were replaced by a hash-to-curve of $\mathsf{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, $\pi$, assures that given a primary input: * $\mathsf{cv} ⦂ \mathsf{ValueCommit^{Orchard}.Output}$ * $\mathsf{dom} ⦂ \{ 0 .. q_{\mathbb{P}}-1 \}$ * $\mathsf{nf_{dom}} ⦂ \{0 .. q_{\mathbb{P}}-1 \}$ * $\mathsf{rk} ⦂ \mathsf{SpendAuthSig^{Orchard}.Public}$ the prover knows an auxiliary input: * $\mathsf{path} ⦂ \{ 0 .. q_{\mathbb{P}}-1 \}^{[\mathsf{MerkleDepth^{Orchard}}]}$ * $\mathsf{pos} ⦂ \{ 0 .. 2^{\mathsf{MerkleDepth^{Orchard}}}\!-1 \}$ * $\mathsf{g_d^{old}} ⦂ \mathbb{P}^*$ * $\mathsf{pk_d^{old}} ⦂ \mathbb{P}^*$ * $\mathsf{v^{old}} ⦂ \{ 0 .. 2^{\ell_{\mathsf{value}}}-1 \}$ * $\text{ρ}^{\mathsf{old}} ⦂ \mathbb{F}_{q_{\mathbb{P}}}$ * $\text{φ}^{\mathsf{old}} ⦂ \mathbb{F}_{q_{\mathbb{P}}}$ * $\mathsf{rcm^{old}} ⦂ \{ 0 .. 2^{\ell^{\mathsf{Orchard}}_{\mathsf{scalar}}}-1 \}$ * $\mathsf{cm^{old}} ⦂ \mathbb{P}$ * $\mathsf{nf^{old}} ⦂ \{ 0 .. q_{\mathbb{P}}-1 \}$ * $\alpha ⦂ \{ 0 .. 2^{\ell^{\mathsf{Orchard}}_{\mathsf{scalar}}}-1 \}$ * $\mathsf{ak}^{\mathbb{P}} ⦂ \mathbb{P}^*$ * $\mathsf{nk} ⦂ \mathbb{F}_{q_{\mathbb{P}}}$ * $\mathsf{rivk} ⦂ \mathsf{Commit^{ivk}.Trapdoor}$ * $\mathsf{rcv} ⦂ \{ 0 .. 2^{\ell^{\mathsf{Orchard}}_{\mathsf{scalar}}}-1 \}$ * $\mathsf{path^{excl}} ⦂ \{ 0 .. q_{\mathbb{P}}-1 \}^{[\mathsf{MerkleDepth^{excl}}]}$ * $\mathsf{pos^{excl}} ⦂ \{ 0 .. 2^{\mathsf{MerkleDepth^{excl}}}\!-1 \}$ * $\mathsf{start} ⦂ \{ 0 .. 2^{\mathsf{MerkleDepth^{Orchard}}}\!-1 \}$ * $\mathsf{end} ⦂ \{ 0 .. 2^{\mathsf{MerkleDepth^{Orchard}}}\!-1 \}$ such that the following conditions hold: **Note commitment integrity** $\hspace{0.5em} \mathsf{NoteCommit^{Orchard}_{rcm^{old}}}(\mathsf{repr}_{\mathbb{P}}(\mathsf{g_d^{old}}), \mathsf{repr}_{\mathbb{P}}(\mathsf{pk_d^{old}}), \mathsf{v^{old}}, \text{ρ}^{\mathsf{old}}, \text{φ}^{\mathsf{old}}) \in \{ \mathsf{cm^{old}}, \bot \}$. **Merkle path validity for** $\mathsf{cm^{old}} \hspace{0.5em} (\mathsf{path^{cm}}, \mathsf{pos^{cm}})$ is a valid Merkle path of depth $\mathsf{MerkleDepth^{Orchard}}$, as defined in § 4.9 'Merkle Path Validity', from $\mathsf{cm^{old}}$ to the anchor $\mathsf{rt^{cm}}$. **Value commitment integrity** $\hspace{0.5em} \mathsf{cv} = \mathsf{ValueCommit^{Orchard}_{rcv}}(\mathsf{v^{old}})$. **Nullifier integrity** $\hspace{0.5em} \mathsf{nf^{old}} = \mathsf{DeriveNullifier_{nk}}(\text{ρ}^{\mathsf{old}}, \text{φ}^{\mathsf{old}}, \mathsf{cm^{old}})$. **Spend authority** $\hspace{0.5em} \mathsf{rk} = \mathsf{SpendAuthSig^{Orchard}.RandomizePublic}(\alpha, \mathsf{ak}^{\mathbb{P}})$. **Diversified address integrity** $\hspace{0.5em} \mathsf{ivk} = \bot$ or $\mathsf{pk_d^{old}} = [\mathsf{ivk}]\, \mathsf{g_d^{old}}$ where $\mathsf{ivk} = \mathsf{Commit^{ivk}_{rivk}}(\mathsf{Extract}_{\mathbb{P}}(\mathsf{ak}^{\mathbb{P}}), \mathsf{nk})$. **Merkle path validity for** $(\mathsf{start}, \mathsf{end}) \hspace{0.5em} (\mathsf{path^{excl}}, \mathsf{pos^{excl}})$ is a valid Merkle path of depth $\mathsf{MerkleDepth^{excl}}$, as defined in § 4.9 'Merkle Path Validity', from $\mathsf{excl}$ to the anchor $\mathsf{rt^{excl}}$, where $\mathsf{excl} = \mathsf{MerkleCRH^{Orchard}}(\mathsf{MerkleDepth^{excl}}, \mathsf{start}, \mathsf{end})$. **Nullifier in excluded range** $\hspace{0.5em} \mathsf{start} \leq \mathsf{nf^{old}} \leq \mathsf{end}$. **Alternate nullifier integrity** $\hspace{0.5em} \mathsf{nf_{dom}} = \mathsf{DeriveAlternateNullifier_{nk}}(\text{ρ}^{\mathsf{old}}, \text{φ}^{\mathsf{old}}, \mathsf{cm^{old}}, \mathsf{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** $(\mathsf{start}, \mathsf{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 $\mathsf{start} \leq \mathsf{end}$, the check becomes equivalent to $0 \leq \mathsf{nf^{old}} - \mathsf{start} \leq \mathsf{end} - \mathsf{start}$. ## Rationale ==TODO== # References [BCP14]: 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> [protocol] Zcash Protocol Specification, Version 2023.4.0 or later <protocol/protocol.pdf>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully