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
  • User Signs Up
  • Attester Signs up

Was this helpful?

Edit on GitHub
  1. Protocol
  2. Contract

Sign up

How the UniRep smart contract can help user and attester sign up.

PreviousContractNextAttestations

Last updated 2 years ago

Was this helpful?

User Signs Up

User signs up by providing an identity commitment. It also inserts a state leaf into the state tree.

function userSignUp(uint256 identityCommitment) external

source:

If user signs up through an attester (msg.sender is a registered attester) and the attester sets the airdrop amount airdropAmount non-zero, the user will have a one non-zero leaf in his user state. The non-zero leaf is computed by

const hasSignedUp = 1
const airdroppedLeaf = hash(airdropPosRep, 0, 0, hasSignedUp)

See:

Attester Signs up

Attester can sign up through attesterSignUp and attesterSignUpViaRelayer.

function attesterSignUp() external override

source:

If an attester signs up through his wallet or another smart contract, UniRep smart contract will record the msg.sender and assign an attester ID to the address.

function attesterSignUpViaRelayer(
    address attester,
    bytes calldata signature
) external override

source:

The attester can also sign up through another relayer, but he has to provide the address of the attester who wants to sign up and the signature. The attester signs over his's own address concatenated with this contract address, then the UniRep smart contract will verify the signature by .

â˜€ī¸
Unirep.sol/userSignUp
core/src/computeInitUserStateRoot
Unirep.sol/attesterSignUp
Unirep.sol/attesterSignUpViaRelayer
verifySignature