Reputation Proof

User generates a proof of his own reputation

  • There are two types of reputation proof in Unirep:

  1. Reputation proof: how much reputation that a user has, which includes reputation from all attesters and airdropped karma.

  2. Reputation from attester proof: how much reputation from a specified attester, which is indicated by attester id

  • Both of the reputation proofs are generated by user with a semaphore identity and the proof can be verified by everyone at the Unirep smart contract.

1. Reputation proof

  • This proof will be generated with a post, a comment, an upvote and a downvote action. The proof is used to ensure that a user has enough reputation to make the action.

  • There is another option that a user can choose to prove how much reputation he has and it exceeds the required reputation for the action.

  • After user made an action, it will create a proof with Unirep.reputationProofprefix. Other users can verify this proof at the Unirep smart contract.

verifyReputationProof

npx ts-node cli/index.ts verifyReputationProof 
                  [-h] 
                  [-e ETH_PROVIDER] 
                  [-ep EPOCH] 
                  -epk EPOCH_KEY 
                  -pf PROOF 
                  -th TRANSACTION_HASH 
                  [-mr MIN_REP]
                  [-b START_BLOCK] 
                  -x CONTRACT
  • This command will help other users with a proof with Unirep.reputationProofprefix to call the Unirep smart contract to verify the proof.

  • The input should match the claim that the prover provides.

  • Actions includes: publishPost, leaveComment, and vote

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
  -epk EPOCH_KEY, --epoch-key EPOCH_KEY
                        The user's epoch key (in hex representation)
  -pf PROOF, --proof PROOF
                        The snark proof of the user's epoch key and reputation
  -th TRANSACTION_HASH, --transaction-hash TRANSACTION_HASH
                        The transaction hash of where user submit the reputation nullifiers
  -mr MIN_REP, --min-rep MIN_REP
                        The minimum reputation score the user has
  -b START_BLOCK, --start-block START_BLOCK
                        The block the Unirep contract is deployed. Default: 0
  -x CONTRACT, --contract CONTRACT
                        The Unirep Social contract address

Options inherited from parent commands

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

2. Reputation proof from attester

genReputationProofFromAttester

npx ts-node cli/index.ts genReputationProofFromAttester 
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -id IDENTITY 
                  -a ATTESTER_ID
                  [-mp MIN_POS_REP]
                  [-mn MAX_NEG_REP]
                  [-md MIN_REP_DIFF]
                  [-gp GRAFFITI_PREIMAGE]
                  [-b START_BLOCK] 
                  -x CONTRACT
                  [-db]
  • The prover (the user with a semaphore identity) can choose to prove how much reputation he receives from a certain attester id, including:

    • minimum positive reputation received from the attester since the first epoch

    • maximum negative reputation received from the attester since the first epoch

    • minimum difference between positive and negative reputation from the attester since the first epoch

    • what is the graffiti pre-image of the reputation, where the graffiti is optional to be attached from the attester

  • If the reputation matches the user's claim, the Circom circuit will generate a valid proof.

  • A string with Unirep.reputationProofFromAttester prefix is the proof of the reputation claim.

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)
  -mp MIN_POS_REP, --min-pos-rep MIN_POS_REP
                        The minimum positive score the attester given to the user
  -mn MAX_NEG_REP, --max-neg-rep MAX_NEG_REP
                        The maximum negative score the attester given to the user
  -md MIN_REP_DIFF, --min-rep-diff MIN_REP_DIFF
                        The difference between positive and negative scores the attester given to the user
  -gp GRAFFITI_PREIMAGE, --graffiti-preimage GRAFFITI_PREIMAGE
                        The pre-image of the graffiti for the reputation the attester given to the user (in hex representation)
  -b START_BLOCK, --start-block START_BLOCK
                        The block the Unirep contract is deployed. Default: 0
  -x CONTRACT, --contract CONTRACT
                        The Unirep Social contract address
  -db, --from-database  Indicate if to generate proving circuit from database

Options inherited from parent commands

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

verifyReputationProofFromAttester

npx ts-node cli/index.ts verifyReputationProofFromAttester 
                  [-h] 
                  [-e ETH_PROVIDER]
                  [-ep EPOCH] 
                  -a ATTESTER_ID
                  [-mp MIN_POS_REP]
                  [-mn MAX_NEG_REP]
                  [-md MIN_REP_DIFF]
                  [-gp GRAFFITI_PREIMAGE] 
                  -pf PROOF 
                  [-b START_BLOCK] 
                  -x CONTRACT
  • This command will help other users with a proof with Unirep.reputationProofFromAttesterprefix to call the Unirep smart contract to verify the proof.

  • The input should match the claim that the prover provides.

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
  -a ATTESTER_ID, --attester-id ATTESTER_ID
                        The attester id (in hex representation)
  -mp MIN_POS_REP, --min-pos-rep MIN_POS_REP
                        The minimum positive score the attester given to the 
                        user
  -mn MAX_NEG_REP, --max-neg-rep MAX_NEG_REP
                        The maximum negative score the attester given to the 
                        user
  -md MIN_REP_DIFF, --min-rep-diff MIN_REP_DIFF
                        The difference between positive and negative scores 
                        the attester given to the user
  -gp GRAFFITI_PREIMAGE, --graffiti-preimage GRAFFITI_PREIMAGE
                        The pre-image of the graffiti for the reputation the 
                        attester given to the user (in hex representation)
  -pf PROOF, --proof PROOF
                        The snark proof of the user's epoch key
  -b START_BLOCK, --start-block START_BLOCK
                        The block the Unirep contract is deployed. Default: 0
  -x CONTRACT, --contract CONTRACT
                        The Unirep Social contract address

Options inherited from parent commands

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

Last updated