Links

User Interaction Functions

How user can interact in the Unirep protocol

Publish a post

  • User can use the command to generate a reputation proof, and call Unirep smart contract to publish a post.

publishPost

npx ts-node cli/index.ts publishPost
[-h]
[-e ETH_PROVIDER]
-tx TEXT
-id IDENTITY
-n EPOCH_KEY_NONCE
[-mr MIN_REP]
-x CONTRACT
[-db]
(-dp | -d ETH_PRIVKEY)
  • The transaction hash and reputation proof will be printed.
  • The reputation proof can be verified by a verifyReputationProof command.

Options

-e ETH_PROVIDER, --eth-provider ETH_PROVIDER
A connection string to an Ethereum provider. Default: http://localhost:8545
-tx TEXT, --text TEXT
The text written in the post
-id IDENTITY, --identity IDENTITY
The (serialized) user's identity
-n EPOCH_KEY_NONCE, --epoch-key-nonce EPOCH_KEY_NONCE
The epoch key nonce
-mr MIN_REP, --min-rep MIN_REP
The minimum reputation score the user has
-x CONTRACT, --contract CONTRACT
The Unirep Social contract address
-db, --from-database Indicate if to generate proving circuit from database
-dp, --prompt-for-eth-privkey
Whether to prompt for the user's Ethereum private key and ignore -d / --eth-privkey
-d ETH_PRIVKEY, --eth-privkey ETH_PRIVKEY
The deployer's Ethereum private key

Options inherited from parent commands

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

Leave a comment

  • User can use the command to generate a reputation proof, and call Unirep smart contract to publish a comment to a specified post.

leaveComment

npx ts-node cli/index.ts leaveComment
[-h]
[-e ETH_PROVIDER]
-tx TEXT
-pid POST_ID
-id IDENTITY
-n EPOCH_KEY_NONCE
[-mr MIN_REP]
-x CONTRACT
[-db]
(-dp | -d ETH_PRIVKEY)
  • The transaction hash and reputation proof will be printed.
  • The reputation proof can be verified by a verifyReputationProof command.

Options

-e ETH_PROVIDER, --eth-provider ETH_PROVIDER
A connection string to an Ethereum provider. Default: http://localhost:8545
-tx TEXT, --text TEXT
The text written in the comment
-pid POST_ID, --post-id POST_ID
The post id where the comment replies to (in decimal representation)
-id IDENTITY, --identity IDENTITY
The (serialized) user's identity
-n EPOCH_KEY_NONCE, --epoch-key-nonce EPOCH_KEY_NONCE
The epoch key nonce
-mr MIN_REP, --min-rep MIN_REP
The minimum reputation score the user has
-x CONTRACT, --contract CONTRACT
The Unirep Social contract address
-db, --from-database Indicate if to generate proving circuit from database
-dp, --prompt-for-eth-privkey
Whether to prompt for the user's Ethereum private key and ignore -d / --eth-privkey
-d ETH_PRIVKEY, --eth-privkey ETH_PRIVKEY
The deployer's Ethereum private key

Options inherited from parent commands

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

Upvote and downvote

  • User can use the command to generate a reputation proof, and call Unirep smart contract to upvote or downvote an epoch key.

vote

npx ts-node cli/index.ts vote
[-h]
[-e ETH_PROVIDER]
-epk EPOCH_KEY
-id IDENTITY
-n EPOCH_KEY_NONCE
[-mr MIN_REP]
[-uv UPVOTE_VALUE]
[-dv DOWNVOTE_VALUE]
[-gf GRAFFITI]
-x CONTRACT
[-db]
(-dp | -d ETH_PRIVKEY)
  • The transaction hash and reputation proof will be printed.
  • The reputation proof can be verified by a verifyReputationProof command.
  • A user should choose either an upvote value or a downvote value.

Options

-e ETH_PROVIDER, --eth-provider ETH_PROVIDER
A connection string to an Ethereum provider. Default: http://localhost:8545
-epk EPOCH_KEY, --epoch-key EPOCH_KEY
The user's epoch key to attest to (in hex representation)
-id IDENTITY, --identity IDENTITY
The (serialized) user's identity
-n EPOCH_KEY_NONCE, --epoch-key-nonce EPOCH_KEY_NONCE
The epoch key nonce
-mr MIN_REP, --min-rep MIN_REP
The minimum reputation score the attester has
-uv UPVOTE_VALUE, --upvote-value UPVOTE_VALUE
Score of positive reputation to give to the user and substract from attester's epoch key
-dv DOWNVOTE_VALUE, --downvote-value DOWNVOTE_VALUE
Score of negative reputation to give to the user and substract from attester's epoch key
-gf GRAFFITI, --graffiti GRAFFITI
Graffiti for the reputation given to the user (in hex representation)
-x CONTRACT, --contract CONTRACT
The Unirep Social contract address
-db, --from-database Indicate if to generate proving circuit from database
-dp, --prompt-for-eth-privkey
Whether to prompt for the user's Ethereum private key and ignore -d / --eth-privkey
-d ETH_PRIVKEY, --eth-privkey ETH_PRIVKEY
The deployer's Ethereum private key

Options inherited from parent commands

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