7. User state transition

See how to generate a user state: 4. Epoch key proof. Then use the user state to generate user state transition proofs.

const {
    startTransitionProof,
    processAttestationProofs,
    finalTransitionProof,
} = await userState.genUserStateTransitionProofs()

Submit start transition proof

const tx = await contract.startUserStateTransition(
    startTransitionProof.publicSignals,
    startTransitionProof.proof
)

Get the proof index of startTransitionProof

const proofIndexes: ethers.BigNumber[] = []
await tx.wait() // should wait until the transaction is confirmed
const proofHash = startTransitionProof.hash()
const proofIndex = await contract.getProofIndex(proofHash)
proofIndexes.push(proofIndex)

Submit process attestations proofs

Submit all process attestations proofs and get the proof indexes.

Submit user state transition proof

Verify UniRep state

It can be checked with either a Synchronizer object or a UserState object. See: 4. Epoch Key Proof.

Check if global state tree root exists in the current UniRep state

Check if epoch tree root matches the epoch

Check epoch key nullifiers are not existed

Last updated

Was this helpful?