> 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` |

1つの共有インスタンスがすべての Rome テストネット/Devnet チェーンを提供します — チェーンは標準の `--chain-id` フラグで選択します。

## Foundry

デプロイ後（参照 [Solidityコントラクトのデプロイ](/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 toolbox に同梱されています。Sourcify プロバイダーを Rome の検証器に向けて、 `hardhat.config.ts` そして次を実行します `hardhat verify`:

```typescript
export default defineConfig({
  // …プラグイン、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/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.
