> 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/ja/gaido/verify-contracts.md).

# コントラクトを検証

ホスト型Sourcifyサービスを通じてRome上のSolidityコントラクトのソースを検証します — 標準的なforge verify-contractとhardhat-verifyのフロー、Viaエクスプローラー上のバッジ。

Romeはホスト型の [Sourcify](https://sourcify.dev) 検証サービスを提供しています。コントラクトを検証すると、そのソースコードとABIが公開され、誰でも再現可能になり、Romeのブロックエクスプローラー（Via）に **✓ ソース検証済み** バッジが表示されます。

検証には標準の `forge verify-contract` および `hardhat-verify` の手順を使用できます。Romeの検証サービスを指定するだけです。

## 検証サービスのエンドポイント

| 環境              | 検証URL                                     |
| --------------- | ----------------------------------------- |
| テストネットとDevnet   | `https://verify.testnet.romeprotocol.xyz` |
| メインネット（Rubicon） | `https://verify.mainnet.romeprotocol.xyz` |

Romeのすべてのテストネット／Devnetチェーンで1つの共通インスタンスを使用します。標準の `--chain-id` フラグでチェーンを選択します。

## Foundry

デプロイ後（ [Solidityコントラクトのデプロイ](https://docs.rome.builders/ja/gaido/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はチェーン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 mainnet: "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>
```

検証済みのコントラクトでは、 `match` フィールドに次の値が返されます。

* **`exact_match`** — バイトコード *と* メタデータハッシュが一致（完全な「full」一致）します。
* **`match`** — バイトコードは一致しますが、メタデータがわずかに異なります（それでも正真正銘の検証済み一致です）。
* `404` / `null` — 未検証です。

## 注意事項

* Romeの検証ツールで検証されたコントラクトは、Rome Via（エクスプローラー）にコントラクト名が表示されます。
* アップグレード可能なプロキシの場合は、プロキシだけでなく実装コントラクトも検証してください。
* 検証に必要なのは、デプロイ済みコントラクトのバイトコードと、提出するソースコードおよびコンパイラー設定だけです。これは、ほかの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/ja/gaido/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.
