Unirep
  • 👏Welcome
  • 🧩Introduction
  • 🎮Getting Started
    • Install & build 🛠
    • Start with cli commands 🔌
      • 0. Install and build
      • 1. Spin up the testing chain
      • 2. Deploy Unirep contract
      • 3. User generates semaphore identity
      • 4. User signs up
      • 5. Attester signs up
      • 6. User generates epoch key and epoch key proof
      • 7. Attesters/Users verify epoch key proof
      • 8. Submit epoch key proof to Unirep smart contract
      • 9. Attester attest to epoch key
      • 10. Epoch transition
      • 11. User state transition
      • 12. User generates reputation proof
      • 13. Attesters/ Users verify the reputation proof
      • 14. User generates sign up proof
      • 15. Attesters/ Users verify the sign up proof
    • Start with Typescript 📠
      • 0. Install packages
      • 1. deploy
      • 2. User signs up
      • 3. Attester signs up
      • 4. Epoch key proof
      • 5. Attest
      • 6. Epoch transition
      • 7. User state transition
      • 8. Reputation proof
    • Computation happens off-chain ℹ️
  • ☀️Protocol
    • Glossary
      • Users and Attesters
      • Epoch
      • Epoch Key
      • Reputation
      • Trees
      • Nullifiers
      • Epoch Transition
      • User State Transition
    • Circuits
      • Epoch Key Proof
      • Reputation Proof
      • User Sign Up Proof
      • User State Transition Proof
    • Contract
      • Sign up
      • Attestations
      • Epoch transition
      • User state transition
      • Verify proofs
  • 🌈Package usage
    • @unirep/crypto
    • @unirep/circuits
    • @unirep/contracts
    • @unirep/core
    • @unirep/subgraph
    • cli
      • Deploy Unirep Contract
      • User Identity
      • User Sign Up
      • Epoch Key And Proof
      • Attestation
      • Epoch transition
      • User state transition
      • Reputation Proof
      • Airdrop Reputation
      • Spend Reputation
  • 🌻Applications
    • Unirep Social
Powered by GitBook
On this page
  • Public inputs
  • Private inputs
  • Contraints
  • 1. Check if user exists in the Global State Tree
  • 2. Check nonce validity
  • 3. Check epoch key is computed correctly

Was this helpful?

Edit on GitHub
  1. Protocol
  2. Circuits

Epoch Key Proof

The zero-knowledge circuit of epoch key proof in UniRep

PreviousCircuitsNextReputation Proof

Last updated 2 years ago

Was this helpful?

is computed by

hash(identityNullifier, epoch, nonce) % epochTreeDepth

The epoch key proof in UniRep is used to prove that

  1. The epoch key is in the epoch that user claims.

  2. The epoch key nonce is between 0 and numEpochKeyNoncePerEpoch - 1.

  3. The owner of the epoch key has in UniRep and has performed the in the latest epoch. In other words, the user has a leaf in the global state tree.

Public inputs

  • epoch: the claimed epoch that the epoch key is in

  • epoch_key: the claimed epoch key

  • GST_root: the global state tree root that the user has a leaf in

Private inputs

  • nonce: the nonce of epoch key. It should be in range [0, numEpochKeyNoncePerEpoch)

  • identity_nullifier: the identity that the semaphore protocol uses, and it is also used to generate an epoch key.

  • identity_trapdoor: the identity trapdoor key that the semaphore protocol uses The hash output of identity_nullifier, and identity_trapdoor is the identity_commitment and it is used to generate a global state tree leaf by

const GST_leaf = hash(identity_commitment, UST_root)
  • user_tree_root: the user state tree root. It is used to compute the global state tree leaf

  • GST_path_index: the path index routes from leaf to root in the global state tree. It should be either 0 or 1 to indicate if the element is in the right sibling or the left sibling.

  • GST_path_elements: The sibling node that should be hashed with current path element to get the root.

Contraints

1. Check if user exists in the Global State Tree

Check if hash(identity_commitment, UST_root) is one of the leaves in the global state tree of root GST_root.

2. Check nonce validity

Check if nonce < EPOCH_KEY_NUM_PER_EPOCH

3. Check epoch key is computed correctly

Check if epoch_key = hash(identityNullifier, epoch, nonce) % epochTreeDepth

See the whole circuit in

☀️
Epoch key
registered
user state transition
circuits/verifyEpochKey.circom