# Off-chain verification

Proofs can be submitted to a verification service for checking.  In order to use a verification service, an endpoint must be obtained from Nebra.  (TODO: link)

Proofs can be submitted using the `upa` command line tool, or programmatically with the Typescript SDK.

## Verification using the `upa`tool

### Install the tool

The standalone `upa`tool can be installed with:

```sh
$ npm install --global @nebrazkp/upa
```

It should then be available in the shell:

```sh
$ upa version
2.0.3
```

### Specify a verification service endpoint

The `--verify-endpoint`flag, or the `VERIFY_ENDPOINT`env var can be used to specify the URL of the verification service to be queried.  It is often convenient to use a `.env`file:

```
VERIFY_ENDPOINT=<endpoint>
```

### Verifying proofs in snarkjs format

Use the `upa off-chain verify-snarkjs`command:

```
$ upa off-chain verify-snarkjs vk.json proof.json
```

(Use `--help`for the full list of arguments)

### Verify proofs in gnark format

Export the VK, proof and inputs to JSON as described [here](/developer-guide/submission-and-verification.md#gnark).&#x20;

Use the `upa off-chain verify-gnark`command:

```
$ upa off-chain verify-gnark vk.json proof.json inputs.json
```

### Verifying proofs in UPA format

If proofs have already been converted to the UPA format (in particular the `AppVkProofInputs` format - see the [section about proof formats](/developer-guide/submission-and-verification.md#step-1-export-proof-data)) they can be submitted individually or in batches using the `upa off-chain verify` command.

## Verification using the SDK

In your Typescript project, add the SDK:

```
$ yarn add @nebrazkp/upa
```

The `VerifierClient`class can then be used to submit proofs for verification:

```typescript
import VerifierClient from "@nebrazkp/sdk/offChainVerify";

const client = new VerifierClient("<ENDPOINT>");
const valid = await client.verify([vkProofInputs]);
```

Note that `vkProofInputs`must be of type \`AppVkProofInputs\`.  See [here](/developer-guide/submission-and-verification.md#step-1-export-proof-data) for information about converting vk and proof formats into instances of this type.


---

# 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://docs.nebra.one/developer-guide/off-chain-verification.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.
