Skip to main content
Version: 1.0.1

User State Transition

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

Epoch keys are iterated computed in the circuits.

2. Update user state tree

Step 1: update leaf index 3Step 2: update leaf index 1

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)
How a new global state tree is computed.

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

User performs user state transition by calling updateUserStateRoot()

  • User will attach a User State Transition Proof 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 global state tree of the latest epoch.
  • 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.