> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/ru/rukovodstva-dlya-razrabotchikov/verify-contracts.md).

# Проверка контрактов

Проверяйте исходный код контрактов Solidity в Rome через размещённый сервис Sourcify — стандартные потоки forge verify-contract и hardhat-verify, значки в обозревателе Via.

Rome предоставляет размещённый [Sourcify](https://sourcify.dev) сервис верификации. После проверки контракта его исходный код и ABI становятся публично воспроизводимыми и отображаются с **✓ Исходный код подтверждён** значком в блокчейн-эксплорере Rome (Via).

Проверка работает со стандартными `forge verify-contract` и `hardhat-verify` процессами — вам лишь нужно указать в них верификатор Rome.

## Конечная точка верификатора

| Окружение               | URL верификатора                          |
| ----------------------- | ----------------------------------------- |
| Testnet и Devnet        | `https://verify.testnet.romeprotocol.xyz` |
| Основная сеть (Rubicon) | `https://verify.mainnet.romeprotocol.xyz` |

Один общий экземпляр обслуживает каждую сеть Rome testnet/devnet — вы выбираете сеть с помощью стандартного `--chain-id` флага.

## Foundry

После развертывания (см. [Развертывание Solidity-контрактов](/ru/rukovodstva-dlya-razrabotchikov/deploy-solidity.md)):

```bash
forge verify-contract <CONTRACT_ADDRESS> src/MyContract.sol:MyContract \
  --verifier sourcify \
  --verifier-url https://verify.testnet.romeprotocol.xyz/ \
  --chain-id <YOUR_CHAIN_ID> \
  --compiler-version 0.8.20
```

Если конструктор принимал аргументы, передайте их, чтобы байт-код совпадал:

```bash
  --constructor-args $(cast abi-encode "constructor(uint256)" 42)
```

Вы также можете выполнить проверку во время развертывания с помощью `forge create … --verify` или `forge script … --verify` (Foundry определяет chain id из `--rpc-url`).

## Hardhat

`hardhat-verify` поставляется с набором инструментов Hardhat 3. Укажите его провайдер Sourcify на верификатор Rome в `hardhat.config.ts` и выполните `hardhat verify`:

```typescript
export default defineConfig({
  // …plugins, solidity, networks…
  verify: {
    etherscan: { enabled: false },
    blockscout: { enabled: false },
    sourcify: {
      enabled: true,
      apiUrl: "https://verify.testnet.romeprotocol.xyz",   // основная сеть Rubicon: "https://verify.mainnet.romeprotocol.xyz"
    },
  },
});
```

```bash
npx hardhat verify --network <your-network> <CONTRACT_ADDRESS> [constructor args…]
```

В случае успеха верификатор создаёт ссылку на опубликованный исходный код, например `https://verify.testnet.romeprotocol.xyz/repo-ui/<CHAIN_ID>/<ADDRESS>`.

## Проверка статуса верификации

Эксплорер получает статус верификации из API верификатора. Вы можете запросить его напрямую:

```bash
curl https://verify.testnet.romeprotocol.xyz/v2/contract/<CHAIN_ID>/<ADDRESS>
```

Проверенный контракт возвращает `совпадение` поле:

* **`exact_match`** — байт-код *и* совпадение хеша метаданных (идеальное, «полное» совпадение).
* **`совпадение`** — байт-код совпадает; метаданные немного отличаются (тем не менее это подлинное, подтверждённое совпадение).
* `404` / `null` — не подтверждено.

## Примечания

* Для верификации требуются только развёрнутый байт-код вашего контракта, а также исходный код и параметры компилятора, которые вы отправляете, — те же входные данные, что и в любой сети EVM.
* Новые сети Rome автоматически подключаются к верификатору; если вы разворачиваете контракт в новой сети, а верификация ещё не находит её, подождите немного или свяжитесь с нами.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rome.builders/ru/rukovodstva-dlya-razrabotchikov/verify-contracts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
