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

# クイックスタート

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

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

## 前提条件

* [Node.js](https://nodejs.org/) v22.13+
* [MetaMask](https://metamask.io/) ブラウザ拡張機能
* 設定された Solana ウォレット **Devnet**、ただし Solana から資金を入れる場合に限ります（ステップ 2）。Solana ウォレットからコントラクトを呼び出すには、Solana v1 トランザクションに署名できるものが必要で、これは次で扱います [コントラクトをSolanaユーザーに公開する](https://docs.rome.builders/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. ウォレットに資金を入れる

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

**Solana から** — 次から Solana Devnet USDC を取得します [Circle faucet](https://faucet.circle.com/) （Solana Devnet を選択）し、Solana の手数料用に少量の devnet SOL を次から取得します [Solana faucet](https://faucet.solana.com/)。Solana ウォレットを Devnet に設定した状態で行います。次に [Rome Bridge](https://docs.rome.builders/ja/romenoapuri/bridge-api.md) を、宛先を Hadrian にし、その Solana ルートを使い、受取人には EVM ウォレットのアドレスを指定します。ブリッジはその EVM ウォレットに Hadrian 上でクレームトランザクションへの署名を求め、それによって USDC が gas に変わります。

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

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

Solana 側の入金が、資金があるにもかかわらず「insufficient SOL」警告で失敗する場合は、Solana ウォレットを Testnet Mode / Devnet に設定してください（次を参照 [FAQ](https://docs.rome.builders/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 をデプロイしました:", hello.address);

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

  console.log("カウンター:", (await hello.read.counter()).toString());
  console.log("挨拶:", await hello.read.greeting());
}

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

Hadrian にデプロイ:

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

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

```
HelloRome をデプロイしました: 0x09c437e305eeb698e1776cff23ca16c1bb25aabd
カウンター: 1
挨拶: Solana からこんにちは！
```

デプロイされたアドレスを [explorer](https://via-hadrian.testnet.romeprotocol.xyz/) 開いてトランザクションを確認し、その「Settled in」リンクをたどって、それを決済した Solana トランザクションを表示してください。これで Solidity コントラクトは Solana 上で動作しています。

## 次は何か

* [Solidityをデプロイ](https://docs.rome.builders/ja/gaido/deploy-solidity.md) — Hardhat と Foundry のデプロイを詳しく解説
* [EVM から Solana を呼び出す](https://docs.rome.builders/ja/gaido/call-solana-from-evm.md) — CPI を使って Solidity から Solana プログラムを呼び出す
* [アーキテクチャ](https://docs.rome.builders/ja/hajimeni-1/architecture.md) — Rome が Solana 内で EVM をどのように実行するか

## よくあるエラー

| エラー                | 原因                                | 対処法                                                                                                                |
| ------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `資金不足`             | gas 上限 × gas 価格に対してガストークンが不足しています | 少なくとも 0.5 USDC 相当の gas を入れてください（ステップ 2 を参照） [Rome Bridge](https://docs.rome.builders/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-1/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.
