# Verify

Use `pop verify` to compare a locally built contract against either a local `.contract` bundle or a deployed contract on a chain.

You can also run the command as `pop v`. Use this command in a contract project with a `Cargo.toml`. It requires the contract feature in Pop CLI (not available in chain-only builds), plus network access when verifying against a deployed contract.

## Usage

```bash
pop verify [--path <PATH> | PATH] --contract-path <FILE>
pop verify [--path <PATH> | PATH] --url <URL> --address <ADDRESS> --image <IMAGE>
```

### JSON mode

Use global `--json` for structured verification results:

```bash
pop --json verify --contract-path ./target/ink/my_contract.contract
```

## Examples

```bash
# Verify against a local .contract bundle
pop verify --contract-path ./target/ink/my_contract.contract

# Verify against a deployed contract
pop verify \
  --url ws://127.0.0.1:9944 \
  --address 5F3sa2TJ... \
  --image <IMAGE>
```

## Verification modes

`pop verify` requires one of these modes:

* Local reference: `--contract-path <FILE>`
* Deployed reference: `--url <URL> --address <ADDRESS> --image <IMAGE>`

If you omit `--contract-path`, Pop requires all three deployed flags.

## Project path resolution

Use `--path` or the positional `PATH` to point at your contract project. If you omit both, Pop uses the current directory.

## Local reference verification

When you verify against a local `.contract` bundle, Pop reads the bundle metadata to determine how it was built:

* If the bundle includes verifiable build info, Pop requires Docker to rebuild the contract.
* Otherwise, Pop checks that your local toolchain and `cargo contract` version match the bundle, then rebuilds locally.

## Deployed reference verification

When you verify a deployed contract, Pop:

* Connects to the chain at `--url` and fetches the deployed contract code hash.
* Rebuilds your local contract using the `--image` Docker image.
* Compares the rebuilt contract hash to the on-chain hash.

Only chains using the latest revive versions are guaranteed to be supported.

## Output

Pop prints a success message when verification passes:

* Local: `The contract is successfully verified ✅`
* Deployed: `The contract deployed on <URL> at address <ADDRESS> is successfully verified ✅`

## Errors and constraints

* If your workspace contains multiple contracts, verification fails. Run the command against a single contract project.
* Deployed verification fails if the chain does not support revive or the contract address is not found.
* Toolchain and `cargo contract` version mismatches will fail verification for non-verifiable bundles.


---

# 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://learn.onpop.io/contracts/guides/verify-contract.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.
