> For the complete documentation index, see [llms.txt](https://unirep.gitbook.io/unirep-social/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unirep.gitbook.io/unirep-social/cli/epoch-key-and-proof.md).

# Epoch Key And Proof

* An epoch key is the only way that a user can receive reputation.
* A user can generate an epoch key with a nonce, the nonce should be less than `numEpochKeyNoncePerEpoch`.
* A user generates the epoch key with a Circom circuit and the epoch key and proof can be verified by attesters in Unirep smart contract.

### `genEpochKeyAndProof`

```
npx ts-node cli/index.ts genEpochKeyAndProof 
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -id IDENTITY 
                  -n EPOCH_KEY_NONCE 
                  [-b START_BLOCK] 
                  -x CONTRACT
```

* epoch key and base64url encoded epoch key proof will be printed
* A string with `Unirep.epkProof` prefix is the proof of this epoch key

### 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
  -n EPOCH_KEY_NONCE, --epoch-key-nonce EPOCH_KEY_NONCE
                        The epoch key nonce
  -b START_BLOCK, --start-block START_BLOCK
                        The block the Unirep contract is deployed. Default: 0
  -x CONTRACT, --contract CONTRACT
                        The Unirep Social contract addres
```

#### Options inherited from parent commands <a href="#options-inherited-from-parent-commands" id="options-inherited-from-parent-commands"></a>

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

### `verifyEpochKeyProof`

```
npx ts-node cli/index.ts verifyEpochKeyProof 
                  [-h] 
                  [-e ETH_PROVIDER] 
                  -epk EPOCH_KEY 
                  -pf PROOF 
                  [-b START_BLOCK] 
                  -x CONTRACT
```

* This command will help other users with an epoch key proof with `Unirep.epkProof` prefix 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
  -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
  -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 <a href="#options-inherited-from-parent-commands" id="options-inherited-from-parent-commands"></a>

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/cli/epoch-key-and-proof.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.
