# Getting Started

### Download Unirep Social

Clone Unirep Social source code from github

```bash
git clone https://github.com/vivianjeng/Unirep-Social.git
```

### Install packages

Install packages used in Unirep Social

```bash
yarn install
```

### Build the Circom circuits

Build circom circuits and generate their constraints and verification keys and proving keys files in the `build/` directory.\
Also export smart contract verifiers to be deployed with Unirep and Unirep Social smart contract.

```bash
yarn build
```

### Test

Test all cli commands

```bash
yarn test-cli
```

Integration test

```bash
yarn test
```

### Example cli commands workflow

#### 1. Run a testing net

We use [hardhat](https://hardhat.org/) here as a blockchain developing environment.

{% hint style="info" %}
**NOTE:** a list of default accounts will be printed, choose one of them to be user's account and one to be attester's. User's and attester's private key will be referred to as `deployerPrivateKey` and `attesterPrivateKey` respectively.

For example:

```
Accounts
========
Account #0: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH) 
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
...

```

{% endhint %}

```bash
npx hardhat node
```

#### 2. Deploy Unirep smart contract and its verifiers

If we choose the first account, we use `0xac097...ff80` as our `deployerPrivateKey`parameter\
Open another terminal and run:

```bash
npx ts-node cli/index.ts deploy -d 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

{% hint style="info" %}
**NOTE:** `-d`is deployer's private key\
Then Unirep and Unirep Social contract's address will be printed. For example,&#x20;

```
Unirep: 0x0165878A594ca255338adfa4d48449f69242Eb8F
Unirep Social: 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
```

{% endhint %}

* Then we use the Unirep Social contract's address to interact with.

{% hint style="info" %}
Unirep Social contract will sign up as the an attester with attester ID`1.`\
When users spend reputation to publish a post or leave a comment, Unirep Social contract will perform as an attester to give users negative reputation.
{% endhint %}

#### 3. **Generate user's identity and identity commitment**

```bash
npx ts-node cli/index.ts genUnirepIdentity
```

{% hint style="info" %}
**NOTE:** base64url encoded identity and identity commitment will be printed, For example,

```
Unirep.identity.WyJlOGQ2NGU5OThhM2VmNjAxZThjZTNkNDQwOWQyZjc3MjEwOGJkMGI1NTgwODAzYjY2MDk0YTllZWExMzYxZjA2IiwiODZiYjk5ZGQ4MzA2ZGVkZDgxYTE4MzBiNmVjYmRlZjk5ZmVjYTU3M2RiNjIxMjk5NGMyMmJlMWEwMWZmMTEiLCIzMGE3M2MxMjE4ODQwNjE0MWQwYmI4NWRjZDY5ZjdhMjEzMWM1NWRkNDQzYWNmMGVhZTEwNjI2NzBjNDhmYSJd278
Unirep.identityCommitment.MTI0ZWQ1YTc4NjYzMWVhODViY2YzZDI4NWFhOTA5MzFjMjUwOTEzMzljYzAzODU3YTVlMzY5ZWYxZmI2NTAzNw
```

{% endhint %}

#### 4. **User signs up**

The user signs up with his identity commitment instead of his real identity.

```bash
npx ts-node cli/index.ts userSignup \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -c Unirep.identityCommitment.MTI0ZWQ1YTc4NjYzMWVhODViY2YzZDI4NWFhOTA5MzFjMjUwOTEzMzljYzAzODU3YTVlMzY5ZWYxZmI2NTAzNw \
    -d 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

{% hint style="info" %}
**NOTE:** `-x` is the Unirep Social contract address and `-c` is user's identity commitment
{% endhint %}

#### 5. Attester signs up

```bash
npx ts-node cli/index.ts attesterSignup \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -d 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
```

{% hint style="info" %}
**NOTE:** `-d` is attester's private key, this private key is to be used only by this attester hereafter
{% endhint %}

{% hint style="warning" %}
**NOTE:** Though user signs up requires a private key, private key is used to interact with smart contract but not link identity commitment and the account.

However, `attesterSignup`bind the account with attester id. Whenever the user wants to attest others, the user has to use the account he has registered for as an attester.

Therefore, users can sign up their identity commitments and their attester ids with different accounts to enjoy more privacy protection.
{% endhint %}

#### 6. **User generates epoch key and epoch key proof**

The user can generate an epoch key with his identity and nonce.

```
npx ts-node cli/index.ts genEpochKeyAndProof \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -id Unirep.identity.WyJlOGQ2NGU5OThhM2VmNjAxZThjZTNkNDQwOWQyZjc3MjEwOGJkMGI1NTgwODAzYjY2MDk0YTllZWExMzYxZjA2IiwiODZiYjk5ZGQ4MzA2ZGVkZDgxYTE4MzBiNmVjYmRlZjk5ZmVjYTU3M2RiNjIxMjk5NGMyMmJlMWEwMWZmMTEiLCIzMGE3M2MxMjE4ODQwNjE0MWQwYmI4NWRjZDY5ZjdhMjEzMWM1NWRkNDQzYWNmMGVhZTEwNjI2NzBjNDhmYSJd \
    -n 0
```

{% hint style="info" %}
**NOTE:** `-id` is user's identity and `-n` is epoch key nonce which should be less than the system parameter `maxEpochKeyNonce`
{% endhint %}

{% hint style="info" %}
**NOTE:** epoch key and base64url encoded epoch key proof will be printed and they should be handed to attester to be verified, for example:

```
Epoch key of epoch 1 and nonce 0: 69
Unirep.epkProof.WyIxNjA4MjU3MzE4NTE4MzU0NjcyNTQ5Mjc1Njg1NDMwMDkwMTEwMjUxNDU0NTAwODQ2NjQ1MTk5Mjg5MzY3NjgwNTI4ODc1MDQ2MjY5NiIsIjE0MzE1OTI5OTQzMDI4NTY5MjA4OTQ3NTYyMTI0MDA5MzUwMjgxMzM3MDQyMjk0MTMxODEzMjI4Mzc5NjY5NzgwNTM5NTQwMzgxNjkyIiwiMTI3NzA1NjIzMTA4OTE1MTEyNDEzOTU3ODQ2NjM0MTE1MDA0OTI4MjMwMDA1NjkzNjEwMjI0MzI1MTY5NjA0NzAzMTgxNzc4MDU0NTEiLCIxMDcwNDAyMTI0MzMwNzkwNzEyMTAxNzY0OTMyMjgwNzkyODgyNzMzNzkwODI1NjQ1NTc5NDAwOTA2OTgwMTc3NTA2OTQ4NzU0MzQyMyIsIjIxNjY5MzkzNjExNTY1MTY2MDU4MDkwMDQzMzYzMDk1MjE4ODY2NTMzOTU3MDY3NDk3NDI3NzU3NzU2NTc1MzExNzU0NzM3NjA1ODQ5IiwiNjE0NDg1NzE0MDQyODMwMTM5ODMxODk1MjI2OTIyODI4NzE2MDg5OTQ3OTAzNDE5MTQwMDA2MjM0MDQ3MDIwOTM1NTgyNDcxOTgzMiIsIjE1MTUxNDE2MDg2NTYxMzU3Njc4MjYzMjg2MDI4NzA2NjA1MTkyNjIyMjM4Mzk5NjkwNzY4MTc4MjE0MjQ3MTE0OTk0NzU5ODY3ODI0IiwiMTExMjE2Mzc3NTAyNTA5OTk1MjEwODUwMTAyNjMzMTIwNDMwOTgzOTE0OTM5NzU0Nzg4OTI0MTQ0NDMzNTk1NjA4NzU2MDA4NzM2MjYiXQ
```

{% endhint %}

#### 7. **Attester verify epoch key proof**

```
npx ts-node cli/index.ts verifyEpochKeyProof \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -epk 69 \
    -pf Unirep.epkProof.WyIxNjA4MjU3MzE4NTE4MzU0NjcyNTQ5Mjc1Njg1NDMwMDkwMTEwMjUxNDU0NTAwODQ2NjQ1MTk5Mjg5MzY3NjgwNTI4ODc1MDQ2MjY5NiIsIjE0MzE1OTI5OTQzMDI4NTY5MjA4OTQ3NTYyMTI0MDA5MzUwMjgxMzM3MDQyMjk0MTMxODEzMjI4Mzc5NjY5NzgwNTM5NTQwMzgxNjkyIiwiMTI3NzA1NjIzMTA4OTE1MTEyNDEzOTU3ODQ2NjM0MTE1MDA0OTI4MjMwMDA1NjkzNjEwMjI0MzI1MTY5NjA0NzAzMTgxNzc4MDU0NTEiLCIxMDcwNDAyMTI0MzMwNzkwNzEyMTAxNzY0OTMyMjgwNzkyODgyNzMzNzkwODI1NjQ1NTc5NDAwOTA2OTgwMTc3NTA2OTQ4NzU0MzQyMyIsIjIxNjY5MzkzNjExNTY1MTY2MDU4MDkwMDQzMzYzMDk1MjE4ODY2NTMzOTU3MDY3NDk3NDI3NzU3NzU2NTc1MzExNzU0NzM3NjA1ODQ5IiwiNjE0NDg1NzE0MDQyODMwMTM5ODMxODk1MjI2OTIyODI4NzE2MDg5OTQ3OTAzNDE5MTQwMDA2MjM0MDQ3MDIwOTM1NTgyNDcxOTgzMiIsIjE1MTUxNDE2MDg2NTYxMzU3Njc4MjYzMjg2MDI4NzA2NjA1MTkyNjIyMjM4Mzk5NjkwNzY4MTc4MjE0MjQ3MTE0OTk0NzU5ODY3ODI0IiwiMTExMjE2Mzc3NTAyNTA5OTk1MjEwODUwMTAyNjMzMTIwNDMwOTgzOTE0OTM5NzU0Nzg4OTI0MTQ0NDMzNTk1NjA4NzU2MDA4NzM2MjYiXQ
```

{% hint style="info" %}
**NOTE:** `-epk` is user's epoch key and `-pf` is the epoch key proof
{% endhint %}

#### 8. **User publish a post with an epoch key and proof**

When a user wants to publish a post, he has to generate his reputation proof to prove that he has enough reputation to make a post. The proof also validate the epoch key.

```
npx ts-node cli/index.ts publishPost \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853\
    -tx postText \
    -d 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
    -id Unirep.identity.WyJlOGQ2NGU5OThhM2VmNjAxZThjZTNkNDQwOWQyZjc3MjEwOGJkMGI1NTgwODAzYjY2MDk0YTllZWExMzYxZjA2IiwiODZiYjk5ZGQ4MzA2ZGVkZDgxYTE4MzBiNmVjYmRlZjk5ZmVjYTU3M2RiNjIxMjk5NGMyMmJlMWEwMWZmMTEiLCIzMGE3M2MxMjE4ODQwNjE0MWQwYmI4NWRjZDY5ZjdhMjEzMWM1NWRkNDQzYWNmMGVhZTEwNjI2NzBjNDhmYSJd \
    -n 0 
```

{% hint style="info" %}
**NOTE:**\
`-n`is an epoch key nonce, and it will generate the user's epoch key with the nonce to this epoch, which should be less than the system parameter `maxEpochKeyNonce`

Epoch key and post ID will be printed

```
Post ID: 608a36e71764bcce46a2a4bb
Epoch key of epoch 1 and nonce 0: 69
Unirep.reputationProof.WyI3NzIzMzE4MTUzOTYzMzg2NDA2MzA3MTExMTk1ODY0NzA3Mzc3MzExODY4MzQ1MDExMjA1MTg2MDU3NTQ5NTc0NDcyMjI5OTAxMjQ5IiwiMjEzNzE1MzA2NTU3Nzg5NDMxNjE5NzAwMTU3ODM1MDQyMjU0Njk1ODQ0MTg0NTk5Njk2NTMwMjQ3NDEzODEyMTY1MDY5MjU3MTM5ODEiLCI2NjgwNDc3MzQ3ODQwMTE4OTU5NzQ0MDQ0Mzg3OTQ0MDA2MTA5NDY5NTgyMDc0NjYwMTcyNjcwODkzNjU4MDA3ODgyMzMzNTE4MjQxIiwiMTA0NTA0MTM3MDExMjQ2NTUyMzg0NjkyMzkyNzk3MjE3NjUxMTc3Njk2ODMzODAxNzE0NjY5Nzk5MTEyNDA3NDk5NjAzNjk0MjQwOTEiLCIyMDYxMTY2NTkzOTA4NDEzNTc2NzIxODk0MzczODkzNTEzMjg2NzcwMDQ1MjExNDkxODQwODE3MjAxNjk2NDU0ODk4MzAxNzI2NzAyMCIsIjQwMzkwNDg1Mjc2NjcxNTg1NjYxMDM5OTY0NTExMjYyNjI0NDUwOTU0MzM4MjYwNTUyNjQ2NTgwNTQ0NjgxNDQzNjI3NjE4MTkxNjkiLCIxOTc1MDE3NjEzODg3ODIzODk1MzA0MDI2ODkyMDgwMTg4MDQ0MTk3NDM2MTY0MjA2NTIzNDc0ODg5NjA0MzE4NTU4Nzk4ODk5NDgzMiIsIjIwNzI5NDY3MDMxMDYyMjAzNzIwNDg5MjM3OTczMTc0MDAyNTkwNDQxOTc1MTQzOTg4NTEyODUxMDE1MDE5MDQ3NzI2MTI2OTI3MjQiXQ
Transaction hash: 0xc4d5e343bbf1f90e75e1a61099358df1506ad6588b84f0546d99b7ea4bef7477
```

{% endhint %}

#### 9. Verify reputation proof of certain transaction

Users can use the reputation proof with the transaction hash to obtain snark circuit and its public inputs. Then user can call the on-chain verifier to verify the proof.

```
npx ts-node cli/index.ts verifyReputationProof \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -epk 69 \
    -pf Unirep.reputationProof.WyI3NzIzMzE4MTUzOTYzMzg2NDA2MzA3MTExMTk1ODY0NzA3Mzc3MzExODY4MzQ1MDExMjA1MTg2MDU3NTQ5NTc0NDcyMjI5OTAxMjQ5IiwiMjEzNzE1MzA2NTU3Nzg5NDMxNjE5NzAwMTU3ODM1MDQyMjU0Njk1ODQ0MTg0NTk5Njk2NTMwMjQ3NDEzODEyMTY1MDY5MjU3MTM5ODEiLCI2NjgwNDc3MzQ3ODQwMTE4OTU5NzQ0MDQ0Mzg3OTQ0MDA2MTA5NDY5NTgyMDc0NjYwMTcyNjcwODkzNjU4MDA3ODgyMzMzNTE4MjQxIiwiMTA0NTA0MTM3MDExMjQ2NTUyMzg0NjkyMzkyNzk3MjE3NjUxMTc3Njk2ODMzODAxNzE0NjY5Nzk5MTEyNDA3NDk5NjAzNjk0MjQwOTEiLCIyMDYxMTY2NTkzOTA4NDEzNTc2NzIxODk0MzczODkzNTEzMjg2NzcwMDQ1MjExNDkxODQwODE3MjAxNjk2NDU0ODk4MzAxNzI2NzAyMCIsIjQwMzkwNDg1Mjc2NjcxNTg1NjYxMDM5OTY0NTExMjYyNjI0NDUwOTU0MzM4MjYwNTUyNjQ2NTgwNTQ0NjgxNDQzNjI3NjE4MTkxNjkiLCIxOTc1MDE3NjEzODg3ODIzODk1MzA0MDI2ODkyMDgwMTg4MDQ0MTk3NDM2MTY0MjA2NTIzNDc0ODg5NjA0MzE4NTU4Nzk4ODk5NDgzMiIsIjIwNzI5NDY3MDMxMDYyMjAzNzIwNDg5MjM3OTczMTc0MDAyNTkwNDQxOTc1MTQzOTg4NTEyODUxMDE1MDE5MDQ3NzI2MTI2OTI3MjQiXQ \
    -th 0xc4d5e343bbf1f90e75e1a61099358df1506ad6588b84f0546d99b7ea4bef7477
```

{% hint style="info" %}
**NOTE:**`-epk` is user's epoch key and \
`-pf` is the epoch key proof\
`-th`is the transaction hash\
\
The verification result will be printed

```
Verify reputation proof of epoch key 69 with 10 reputation 
spent in 0xc4d5e343bbf1f90e75e1a61099358df1506ad6588b84f0546d99b7ea4bef7477 transaction 
and minimum reputation 0, succeed
```

{% endhint %}

#### 10. Attester upvotes to epoch key

To upvote an epoch key, we need another user with different identity. So we generate an identity and sign up the second user in the same way.

```
npx ts-node cli/index.ts genUnirepIdentity
npx ts-node cli/index.ts userSignup \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853\
    -c Unirep.identityCommitment.YTk0NjJjMWE5ZWY3NjM3MWVkOTFjNDA0YTYxYWJlMjVjMjJiMjVmMTM1MzU3NjFjNjE5OGE2YTA4MGUxMDBm \
    -d 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
```

{% hint style="info" %}
**NOTE:** In `genUnirepIdentity` function, the output identity and its commitment is

```
Unirep.identity.WyIxNzk1MTYyYWM2ZDVkZGQ4NWEyMzA0MDdkMjNiOTk3NDU0YmYwNzY2Zjg5ZThkNTQxNWE3ZTIyNTIyN2IxODRiIiwiZDgyNjA0ODY5Njk4NTU3MGMwYzNmNDlhM2RiZDg4MWJjOWJhYjc4Yzg2ZmM0N2UyOTMwNWVjMDEyMDNkZSIsImRkNmZiNDRkMTY3YjFmOTZiYzViZDUyYjdjNGRjOTNiYjhmNDA0Y2Q5YzBjMjA5ODU0ZWMyZWJlOGE0OTMyIl0
Unirep.identityCommitment.YTk0NjJjMWE5ZWY3NjM3MWVkOTFjNDA0YTYxYWJlMjVjMjJiMjVmMTM1MzU3NjFjNjE5OGE2YTA4MGUxMDBm
```

{% endhint %}

Upvote or downvote will cost attester's reputation. Therefore, attester also generates his own epoch key to receive negative reputation.

```
npx ts-node cli/index.ts vote \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -d 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
    -epk 69 \
    -uv 3 \
    -id Unirep.identity.WyIxNzk1MTYyYWM2ZDVkZGQ4NWEyMzA0MDdkMjNiOTk3NDU0YmYwNzY2Zjg5ZThkNTQxNWE3ZTIyNTIyN2IxODRiIiwiZDgyNjA0ODY5Njk4NTU3MGMwYzNmNDlhM2RiZDg4MWJjOWJhYjc4Yzg2ZmM0N2UyOTMwNWVjMDEyMDNkZSIsImRkNmZiNDRkMTY3YjFmOTZiYzViZDUyYjdjNGRjOTNiYjhmNDA0Y2Q5YzBjMjA5ODU0ZWMyZWJlOGE0OTMyIl0 \
    -n 0 \
    -gf 176ff05d9c7c4528b04553217098a71cd076d52623dab894a7f7ee34116ca170
```

{% hint style="info" %}
**NOTE:**`-epk` is the epoch key the user wants to give reputation to\
`-uv` is the upvote value (`-dv` is the downvote value)\
`-id` is the attester's identity\
`-n` is the epoch key nonce where the attester has to give a negative reputation to oneself\
`-gf` is the graffiti for the reputation given to the user\
`-d` is the attester's private key

```
Attesting to epoch key 69 with pos rep 3, neg rep 0 and graffiti 176ff05d9c7c4528b04553217098a71cd076d52623dab894a7f7ee34116ca170 (overwrite graffit: true)
Transaction hash: 0xb621c0debde8a4d3e0edb5aeeb7a43b2d97687d055d7ee99e5742cc0574ecbe9
```

{% endhint %}

{% hint style="success" %}
The proof can also be verified with `verifyReputationProof`function
{% endhint %}

#### 11. **Epoch transition**

```
npx ts-node cli/index.ts epochTransition \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853\
    -d 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
    -t
```

{% hint style="info" %}
**NOTE:** `-d` private key could be anyone's private key and `-t` indicates it's testing environment so it will fast forward to the end of epoch

```
Transaction hash: 0xa17db80b864188db48cc78486167f5ec90a2214c0b1988defc0df04a46b2ecf3
End of epoch: 1
```

{% endhint %}

**12. User state transition**

```
npx ts-node cli/index.ts userStateTransition \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -d 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
    -id Unirep.identity.WyJlOGQ2NGU5OThhM2VmNjAxZThjZTNkNDQwOWQyZjc3MjEwOGJkMGI1NTgwODAzYjY2MDk0YTllZWExMzYxZjA2IiwiODZiYjk5ZGQ4MzA2ZGVkZDgxYTE4MzBiNmVjYmRlZjk5ZmVjYTU3M2RiNjIxMjk5NGMyMmJlMWEwMWZmMTEiLCIzMGE3M2MxMjE4ODQwNjE0MWQwYmI4NWRjZDY5ZjdhMjEzMWM1NWRkNDQzYWNmMGVhZTEwNjI2NzBjNDhmYSJd
```

{% hint style="info" %}
The transition result will be printed

```
Transaction hash: 0x2d53cc5624ee47bae888f1a938e14a362a7ea94dc7e8afc0df1a4aafe90e34f5
User transitioned from epoch 1 to epoch 2
```

{% endhint %}

#### 13. **User generate reputation proof from certain attester**

After user state transition, the user can generate a proof to prove that he has reputation from certain attester.

```
npx ts-node cli/index.ts genReputationProofFromAttester \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 \
    -id Unirep.identity.WyJlOGQ2NGU5OThhM2VmNjAxZThjZTNkNDQwOWQyZjc3MjEwOGJkMGI1NTgwODAzYjY2MDk0YTllZWExMzYxZjA2IiwiODZiYjk5ZGQ4MzA2ZGVkZDgxYTE4MzBiNmVjYmRlZjk5ZmVjYTU3M2RiNjIxMjk5NGMyMmJlMWEwMWZmMTEiLCIzMGE3M2MxMjE4ODQwNjE0MWQwYmI4NWRjZDY5ZjdhMjEzMWM1NWRkNDQzYWNmMGVhZTEwNjI2NzBjNDhmYSJd \
    -a 2 \
    -mp 2 \
    -mn 1 \
    -gp 0
```

{% hint style="info" %}
**NOTE:** `-a` is attester's id\
`-mp` is the minimum positive reputation score, i.e, user wants to prove that the attester gave the user a positive reputation score that's larger than the minimum positive reputation score\
`-mn` is the maximum negative reputation score, i.e, user wants to prove that the attester gave the user a negative reputation score that's less than the maximum negative reputation score\
`-md` is the minimum difference between positive and negative reputation scores\
`-gp` is the pre-image of the graffiti for the reputation

**NOTE:** `gp` in this case, 0 being the hash pre-image of `176ff05d9c7c4528b04553217098a71cd076d52623dab894a7f7ee34116ca170`

Proof will be printed and it should be handed to the receiver of this proof, for example,

```
Proof is correct
Proof of reputation from attester 2:
Unirep.reputationProofFromAttester.WyIxNTIzOTA2NTM1NjEyMDU2MTMzNzI0NzkyNDA2ODMyMzE1MTc4NTI0NTcwMjA0MjAwMjQzNTM1MTAxNjc4NzY4OTkyMzMzNDE3Njk2MSIsIjE5Nzc0MTk5NTEyMDExMzkwNTM4MDU2OTMxMTA4ODkwMTg5Nzc3MTMwOTA1ODA4MzI5NzkyMDU3MDEwMTI0MDIxNTMwMDgwMzUxMTY1IiwiMzgzMTU4MzY0NDY5MzMxNzcxODc3NzE4MjE5OTExMTYwMjI3MDI0MTcwODY0Mjg3Mzc0NTczMDA4MzU0OTE2ODA2OTkxMzU5MDc0MSIsIjE1NDkwNzIyODk0NTk0NTE2OTI4ODgwNjA5MDE3MTgzMDg4MDk0MjM4MTgxNDE1ODM1ODU1MDg0NDgwNTAyNjI1NjI1MDY4NjY0Mjk0IiwiMTExMjQ3ODA3MTI3MjQyNTgwMjkyMjM4OTc0OTg2NDQxOTE1NDQyNzIyOTg0MTE1MDk4OTUyMTYxNDk0Njg2NjQwNDk1ODk0Mjg4NjYiLCI3NzU3NzUwMzIzMjI2NDM2MDMwMDM3MTAyMDY5MzQxODMyNDcxNTEyOTQ5NjgwODQzMzE4OTk2NDc5ODI4NTAzOTE2MDU0NDA3NDIyIiwiMTk4OTUyODA4NzUwNjM2Mjg3MjEwNjY0NTgxMTIxNzM2MTg5NDEyNjMxNjA5NjU1OTQzNDkxMzkzMjEwMzkyMjc1MjY1NDg0NzUwOTQiLCIxNjg4NTA1MjIzNjU4NjI1MDM2ODM4MTc3ODAyMjM0OTk2MTE0ODgzMzg2Mzg2OTE1MTA0MzgwODI2MzY1NzYyMzE1ODI1NTA3MDc1Il0
```

{% endhint %}

#### 14. **Verify the reputation proof**

Every user with the reputation proof can verify the proof and its claim.

```
npx ts-node cli/index.ts verifyReputationProofFromAttester \
    -x 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853\
    -a 2 \
    -mp 2 \
    -mn 1 \
    -gp 0 \
    -pf Unirep.reputationProofFromAttester.WyIxNTIzOTA2NTM1NjEyMDU2MTMzNzI0NzkyNDA2ODMyMzE1MTc4NTI0NTcwMjA0MjAwMjQzNTM1MTAxNjc4NzY4OTkyMzMzNDE3Njk2MSIsIjE5Nzc0MTk5NTEyMDExMzkwNTM4MDU2OTMxMTA4ODkwMTg5Nzc3MTMwOTA1ODA4MzI5NzkyMDU3MDEwMTI0MDIxNTMwMDgwMzUxMTY1IiwiMzgzMTU4MzY0NDY5MzMxNzcxODc3NzE4MjE5OTExMTYwMjI3MDI0MTcwODY0Mjg3Mzc0NTczMDA4MzU0OTE2ODA2OTkxMzU5MDc0MSIsIjE1NDkwNzIyODk0NTk0NTE2OTI4ODgwNjA5MDE3MTgzMDg4MDk0MjM4MTgxNDE1ODM1ODU1MDg0NDgwNTAyNjI1NjI1MDY4NjY0Mjk0IiwiMTExMjQ3ODA3MTI3MjQyNTgwMjkyMjM4OTc0OTg2NDQxOTE1NDQyNzIyOTg0MTE1MDk4OTUyMTYxNDk0Njg2NjQwNDk1ODk0Mjg4NjYiLCI3NzU3NzUwMzIzMjI2NDM2MDMwMDM3MTAyMDY5MzQxODMyNDcxNTEyOTQ5NjgwODQzMzE4OTk2NDc5ODI4NTAzOTE2MDU0NDA3NDIyIiwiMTk4OTUyODA4NzUwNjM2Mjg3MjEwNjY0NTgxMTIxNzM2MTg5NDEyNjMxNjA5NjU1OTQzNDkxMzkzMjEwMzkyMjc1MjY1NDg0NzUwOTQiLCIxNjg4NTA1MjIzNjU4NjI1MDM2ODM4MTc3ODAyMjM0OTk2MTE0ODgzMzg2Mzg2OTE1MTA0MzgwODI2MzY1NzYyMzE1ODI1NTA3MDc1Il0
```

{% hint style="info" %}
The verification result will be printed

```
Verify reputation proof from attester 2 with min pos rep 2, max neg rep 1 and graffiti pre-image 0, succeed
```

{% endhint %}

{% hint style="success" %}
User can optionally choose to prove among `-mp`, `-mn`, `-md` or `-gp`\
But the inputs of verification should be identical with the claim of which user uses to generate the proof.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unirep.gitbook.io/unirep-social/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
