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
- Prove the latest reputation status.
- 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.](/img/v1/UST-0.png)
2. Update user state tree
![Step 1: update leaf index 3](/img/v1/UST-1.png)
![Step 2: update leaf index 1](/img/v1/UST-2.png)
3. Check if epoch tree root matches computed hashchains and epoch keys
![](/img/v1/epoch-tree.png)
4. Compute a new global state tree leaf
const newLeaf = hash(idCommitment, userStateTreeRoot)
![How a new global state tree is computed.](/img/v1/UST-3.png)
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.
info