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
  • setAirdropAmount
  • Options
  • genUserSignUpProof
  • Options
  • verifyUserSignUpProof
  • giveAirdrop
  • Options

Was this helpful?

Edit on GitHub
  1. Package usage
  2. cli

Airdrop Reputation

Attester sets airdrop amount and users can get airdrop reputation

setAirdropAmount

npx ts-node cli/index.ts setAirdropAmount
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -x CONTRACT 
                  -a AIRDROP 
                  -d ETH_PRIVKEY
  • The attester that has registered in UniRep can set the airdrop amount and give it to users that register through the attester's account/smart contract.

  • UniRep contract will also set the sign up flag to 1.

Options

  -e ETH_PROVIDER, --eth-provider ETH_PROVIDER
                        A connection string to an Ethereum provider. Default: http://localhost:8545
  -x CONTRACT, --contract CONTRACT
                        The Unirep contract address
  -a AIRDROP, --airdrop AIRDROP
                        The amount of airdrop positive reputation given by the attester
  -d ETH_PRIVKEY, --eth-privkey ETH_PRIVKEY
                        The attester's Ethereum private key

Options inherited from parent commands

  -h, --help            Show this help message and exit.

genUserSignUpProof

npx ts-node cli/index.ts genUserSignUpProof
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -id IDENTITY 
                  -a ATTESTER_ID 
                  -x CONTRACT
  • Attester can give user a sign up flag to indicate the user is one of the membership of the attester's application (or event).

  • Then user can generate a sign up proof to show that he has been authenticated by the attester.

Options

  -e ETH_PROVIDER, --eth-provider ETH_PROVIDER
                        A connection string to an Ethereum provider. Default: http://localhost:8545
  -id IDENTITY, --identity IDENTITY
                        The (serialized) user's identity
  -a ATTESTER_ID, --attester-id ATTESTER_ID
                        The attester id (in hex representation)
  -x CONTRACT, --contract CONTRACT
                        The Unirep contract address

Options inherited from parent commands

  -h, --help            Show this help message and exit.

verifyUserSignUpProof

npx ts-node cli/index.ts verifyUserSignUpProof
                  [-h] 
                  [-e ETH_PROVIDER] 
                  [-ep EPOCH] 
                  -p PUBLIC_SIGNALS 
                  -pf PROOF 
                  -x CONTRACT
  • Options

  -e ETH_PROVIDER, --eth-provider ETH_PROVIDER
                        A connection string to an Ethereum provider. Default: http://localhost:8545
  -ep EPOCH, --epoch EPOCH
                        The latest epoch user transitioned to. Default: current epoch
  -p PUBLIC_SIGNALS, --public-signals PUBLIC_SIGNALS
                        The snark public signals of the user's epoch key
  -pf PROOF, --proof PROOF
                        The snark proof of the user's epoch key
  -x CONTRACT, --contract CONTRACT
                        The Unirep contract address

Options inherited from parent commands

  -h, --help            Show this help message and exit.

giveAirdrop

npx ts-node cli/index.ts giveAirdrop
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -p PUBLIC_SIGNALS 
                  -pf PROOF 
                  -x CONTRACT 
                  -d ETH_PRIVKEY
  • After receiving the user sign up proof, the attester knows that the user has been authenticated before and the attester can give the attester the airdrop reputation to let the user spend the reputation.

Options

  -e ETH_PROVIDER, --eth-provider ETH_PROVIDER
                        A connection string to an Ethereum provider. Default: http://localhost:8545
  -p PUBLIC_SIGNALS, --public-signals PUBLIC_SIGNALS
                        The snark public signals of the user's epoch key
  -pf PROOF, --proof PROOF
                        The snark proof of the user's epoch key
  -x CONTRACT, --contract CONTRACT
                        The Unirep contract address
  -d ETH_PRIVKEY, --eth-privkey ETH_PRIVKEY
                        The attester's Ethereum private key

Options inherited from parent commands

  -h, --help            Show this help message and exit.
PreviousReputation ProofNextSpend Reputation

Last updated 2 years ago

Was this helpful?

source:

See

source:

source:

source:

🌈
core/cli/setAirdropAmount.ts
user sign up proof
core/cli/genUserSignUpProof.ts
core/cli/verifyUserSignUpProof.ts
core/cli/giveAirdrop.ts