> 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/hajimeni/quickstart.md).

# クイックスタート

5分以内にRomeへ最初のSolidityコントラクトをデプロイします。

5分以内で、Romeに最初のSolidityコントラクトをデプロイしましょう。このガイドの対象は [**Hadrian**](/ja/nettowku/hadrian.md)、公開テストネットチェーンです。 [Rubicon](/ja/nettowku/rubicon.md) はメインネットチェーンで、ガスは実際のUSDCです。まずはテストチェーンで何でも試してください。

## 前提条件

* [Node.js](https://nodejs.org/) v22.13+
* [MetaMask](https://metamask.io/) ブラウザ拡張機能
* Solanaウォレットを **Devnet**に設定します。これはSolanaから資金を入れる場合（手順2）のみです。Solanaウォレットからコントラクトを呼び出すには、Solana v1トランザクションに署名できるウォレットが必要で、それについては [Solanaユーザーにコントラクトを開放する](/ja/gaido/open-to-solana-users.md).

## 1. MetaMaskにHadrianを追加する

手動で追加します（設定 → ネットワーク → ネットワークを追加）：

| 項目           | 値                                               |
| ------------ | ----------------------------------------------- |
| ネットワーク名      | Rome Hadrian                                    |
| RPC URL      | `https://hadrian.testnet.romeprotocol.xyz/`     |
| チェーンID       | `200010`                                        |
| 通貨記号         | `USDC`                                          |
| ブロックエクスプローラー | `https://via-hadrian.testnet.romeprotocol.xyz/` |

## 2. ウォレットに資金を入れる

ガスはチェーンのガストークンで支払われます。HadrianではUSDCです。HadrianではCircleのSolana Devnet USDC（ミント `4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU`）によって裏付けられているため、devnet SOLはガスではありません。RomeのFaucetはありません。HadrianでUSDCを入手する方法は2つあります：

**Solanaから** — Solana Devnet USDCを [Circleファウセット](https://faucet.circle.com/) （Solana Devnetを選択）から入手し、Solanaの手数料用に少量のdevnet SOLを [Solanaファウセット](https://faucet.solana.com/)から入手します。SolanaウォレットはDevnetに設定してください。その後、 [Rome Bridge](/ja/romenoapuri/bridge-api.md) を使い、送信先をHadrian、経路をSolanaに、受取人をEVMウォレットのアドレスにします。ブリッジは、そのEVMウォレットにHadrian上での請求トランザクションへの署名を求め、それによってUSDCがガスに変わります。

**EVMチェーンからブリッジして入れる方法** — Ethereum SepoliaでテストUSDCを [Circleファウセット](https://faucet.circle.com/)からミントし、次に [Rome Bridge](/ja/romenoapuri/bridge-api.md) （CCTP）でRomeに持ってきます。送信元側のトランザクションには少量のSepolia ETHが必要です — [フォーセット](/ja/rissu/faucets.md) 各Faucetについて参照してください。

**いくら必要？** Romeでの書き込みは、Ethereumの感覚よりも高くつきます。なぜなら、そのガスの大半はSolanaアカウントの作成に使われるからです。まだ使われたことのない受信者、新しいトークンアカウント、デプロイ済みコントラクトなどです。使用してください `eth_estimateGas`、標準的なツールがそうするように、21,000をハードコードしてはいけません。見積もりにはアカウント作成が含まれ、Romeはトランザクションが実際に使用したガスだけを請求します（Hadrianでの計測では、実際に見積もりを超えることはありませんでした）。そしてSDKの `submitRomeTx` 見積もりに1.3倍の余裕を持たせますが、請求されるのは実際に使ったガスだけなので、追加コストはありません。少なくとも **0.5 USDC分のガス**は必要です。1 USDCあれば十分な余裕があります。 [JSON-RPCサポート](/ja/rifarensu/json-rpc.md) の数値は、個々の書き込みにいくらかかるかを示しています。

Solana側の入金が、資金はあるのに「insufficient SOL」警告で失敗する場合は、SolanaウォレットをTestnet Mode / Devnetに設定してください（ [FAQ](/ja/rissu/faq.md)).

## 3. Hardhatプロジェクトを作成する

```bash
mkdir rome-hello && cd rome-hello
npx hardhat --init
```

プロンプトではデフォルトを受け入れてください — Hardhat 3、現在のディレクトリ、TypeScript + Node Test Runner + viem テンプレート — そして依存関係をインストールさせます。このテンプレートにはサンプルの `Counter` テスト付きのコントラクトが含まれていますが、このガイドには影響しません。

## 4. Rome用にHardhatを設定する

生成された `hardhat.config.ts` を編集し、その中にRomeのネットワークを追加します `defineConfig({ ... })`:

```typescript
  networks: {
    hadrian: {
      type: "http",
      chainType: "l1",
      chainId: 200010,
      url: "https://hadrian.testnet.romeprotocol.xyz/",
      accounts: [configVariable("PRIVATE_KEY")],
    },
  },
```

`configVariable("PRIVATE_KEY")` は環境変数から解決されるので、MetaMaskの秘密鍵をエクスポートします：

```bash
export PRIVATE_KEY="0xYOUR_PRIVATE_KEY"
```

（使い捨てキー以外では、ツールボックスに付属する暗号化キーストアを使うことを推奨します： `npx hardhat keystore set PRIVATE_KEY`.)

## 5. コントラクトを書く

作成 `contracts/HelloRome.sol`:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

contract HelloRome {
    string public greeting = "Solanaからこんにちは！";
    uint256 public counter;

    event Greeted(address indexed sender, uint256 count);

    function greet() external returns (string memory) {
        counter++;
        emit Greeted(msg.sender, counter);
        return greeting;
    }

    function setGreeting(string calldata _greeting) external {
        greeting = _greeting;
    }
}
```

## 6. デプロイする

作成 `scripts/deploy.ts`:

```typescript
import hardhat from "hardhat";

async function main() {
  const { viem } = await hardhat.network.connect();
  const publicClient = await viem.getPublicClient();

  const hello = await viem.deployContract("HelloRome");
  console.log("HelloRome deployed to:", hello.address);

  const hash = await hello.write.greet();
  await publicClient.waitForTransactionReceipt({ hash });

  console.log("Counter:", (await hello.read.counter()).toString());
  console.log("Greeting:", await hello.read.greeting());
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
```

Hadrianにデプロイします：

```bash
npx hardhat run scripts/deploy.ts --network hadrian
```

期待される出力（あなたのアドレスは異なります）：

```
HelloRome deployed to: 0x09c437e305eeb698e1776cff23ca16c1bb25aabd
Counter: 1
Greeting: Solanaからこんにちは！
```

デプロイ先のアドレスを [エクスプローラー](https://via-hadrian.testnet.romeprotocol.xyz/) で開くと、トランザクションの背後にあるSolana命令を確認できます。これであなたのSolidityコントラクトはSolana上で動作しています。

## 次は

* [Solidityをデプロイ](/ja/gaido/deploy-solidity.md) — HardhatとFoundryによるデプロイを詳しく見る
* [EVMからSolanaを呼ぶ](/ja/gaido/call-solana-from-evm.md) — CPIを使ってSolidityからSolanaプログラムを呼び出す
* [アーキテクチャ](/ja/hajimeni/architecture.md) — RomeがSolana内でEVMを実行する仕組み

## よくあるエラー

| エラー              | 原因                          | 修正                                                                             |
| ---------------- | --------------------------- | ------------------------------------------------------------------------------ |
| `残高不足`           | ガス上限×ガス価格に対してガストークンが不足しています | 少なくとも0.5 USDC分のガスを入れてください（手順2を参照） [Rome Bridge](/ja/romenoapuri/bridge-api.md) |
| `nonceが低すぎます`    | トランザクションnonceの不一致           | アカウントをリセットします（MetaMask → 設定 → 詳細設定 → アクティビティを消去）                               |
| `実行がrevertされました` | コントラクトの実行に失敗しました            | コントラクトのロジックを確認してください。 `eth_call` デバッグに使います                                     |
| 接続タイムアウト         | RPCに到達できません                 | RPC URLを確認してください                                                               |


---

# 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/hajimeni/quickstart.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.
