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
  • How does the Unirep protocol work?
  • 1. Registration
  • 2. Give Reputation
  • 3. Receive Reputation
  • 4. Prove Reputation
  • 5. Advanced

Was this helpful?

Edit on GitHub

Introduction

Introduction to Unirep protocol

PreviousWelcomeNextGetting Started

Last updated 2 years ago

Was this helpful?

How does the Unirep protocol work?

There are two different actors in the Unirep protocol: users and attesters

  • Users can receive and spend , prove their reputation, and use temporary identities called to interact with other people. Users can generate a set of new epoch keys every (in this case, 7 days). In a way, the user gets a completely new identities every epoch which preserves their privacy.

  • Attesters represent users to give reputation to an epoch key. Attester IDs are public and unchangeable so users can always prove that the reputation is from the attester.

1. Registration

Users and attesters use different ways to sign up in Unirep

User signup and attester signup in Unirep
  • User

    The user holds the identity like a private key, and the identity commitment is like a public key that is submitted to the Unirep contract.

  • Attester

    The attester uses his own wallet or the address of a smart contract to register. After calling the attester sign up function, the Unirep contract will assign an attester ID to this address.

    Whenever the attester gives an attestation, the Unirep contract will check whether the address is registered. If it is registered, the attester is allowed to give reputation to an epoch key.

    Note: Everyone can sign up as an attester with their wallet address and will receive a new attester ID

2. Give Reputation

Only epoch keys can receive reputation.

After seeing the valid epoch key and epoch key proof, the attester (or a user can submit an attestation through an attester) can give reputation to the epoch key through the Unirep smart contract.

3. Receive Reputation

4. Prove Reputation

  1. whether the user exists, has the claimed reputation (for example, it sums up positive and negative reputation from a specified attester ID)

  2. The user performs User State Transition in the given epoch.

5. Advanced

To see more functions in Unirep, please refer to the following links

A user generates identity and identity commitment through .

How an attester attests to an epoch key

After a user signs up to Unirep, he can generate epoch keys to receive reputation. These epoch keys change every epoch, are unique to every user and look completely random. Therefore, to convince others that the epoch key is computed correctly with the current epoch and a valid nonce, an is used. Also, to convince others the epoch key is generated by a signed up user, the is proposed. If the output global state tree root matches one of the history roots in given epoch, others can be sure that the epoch key owner is a valid user in the given epoch.

A user can prove which epoch key he owns and everyone can easily query how much reputation the epoch key has from the contract. A user that has received some bad reputation during a certain epoch could decide not to show those epoch keys to other users. Therefore, after an epoch ends and all epoch keys are sealed, Unirep restricts users to generate a proof that is used to update their reputation status.

User State Transition in Unirep

The is used to ensure that the user calculates the latest user state (represents by a ) in the correct way, and the user does not miss any attestation.

After a user performs a User State Transition, he will have the latest user state. At this time, the user can prove everyone on the platform how many reputation points he has in Unirep through a . The reputation proof checks

🧩
Semaphore
User State Transition
reputation proof
Spend reputation
Airdrop reputation
reputation
epoch keys
epoch
epoch key proof
User State Transition Proof
Global State Tree (GST)
User State Tree (UST)