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
  • Why users have to perform user state transition?
  • Workflow of a user state transition

Was this helpful?

Edit on GitHub
  1. Protocol
  2. Glossary

User State Transition

Definition of user state transition in UniRep protocol.

PreviousEpoch TransitionNextCircuits

Last updated 2 years ago

Was this helpful?

Why users have to perform user state transition?

User state transition is used to

  • Make sure users process their attestations correctly including the bad reputation.

  • Generate a new user state in a new epoch to prove the latest reputation.

After user performs user state transition, he can

  1. Prove the latest reputation status.

  2. Generate new epoch key proofs to receive attestations in the latest epoch.

Workflow of a user state transition

1. User computes epoch key of the latest transition (or sign up) epoch

2. Update user state tree

3. Check if epoch tree root matches computed hashchains and epoch keys

4. Compute a new global state tree leaf

const newLeaf = hash(idCommitment, userStateTreeRoot)

5. Call unirep smart contract to insert a new global state tree leaf

  • So if a user does not perform user state transition during an epoch, his user state will not be in the global state tree of that epoch.

See also

User performs user state transition by calling

User will attach a when calling updateUserStateRoot. Others can make sure if the user state transition is correct by verifying the User State Transition Proof.

Once the user performed user state transition, his user state will be inserted into the of the latest epoch.

â˜€ī¸
updateUserStateRoot()
User State Transition Proof
Trees
Epoch Transition
User State Transition Proof
global state tree
Epoch keys are iterated computed in the circuits.
Step 1: update leaf index 3
Step 2: update leaf index 1
How a new global state tree is computed.