> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/jp/kaihatsu/kihon/smart-contract-deploy/remix-deploy.md).

# Remix でデプロイする

[Remix](https://remix.live/) はセットアップ不要の smart contract 開発ツールセットです。エキスパートにも初心者にも使われており、Remix を使えばすぐに作業を始められます。

Remix は[ウェブベース環境](https://remix.ethereum.org/)、[デスクトッププログラム](https://github.com/remix-project-org/remix-desktop)、さらには [CLI ツール](https://www.npmjs.com/package/@remix-project/remixd)として利用できます。\
このページでは、ウェブベース版を使用します。

{% hint style="info" %}
[contract の作成と deploy に関する公式 Remix IDE ドキュメント](https://remix-ide.readthedocs.io/en/latest/create_deploy.html)を利用することもできます。
{% endhint %}

Remix Online IDE を使って smart contract を deploy する方法は次のとおりです。

1. [<mark style="color:blue;">https://remix.ethereum.org</mark>](https://remix.ethereum.org) にアクセスします。Remix IDE がブラウザで開きます。<br>

   <figure><img src="/files/5nvS2XE8yTMRo9bNSozz" alt=""><figcaption></figcaption></figure>
2. 「Create a new Workspace」ボタンをクリックし、オプションを選択します。空のワークスペース、AI 生成ワークスペース、contract ウィザード、プロジェクトのインポート、git リポジトリのクローンのいずれかです。カテゴリ分けされたワークスペーステンプレートを利用することもできます。\
   このチュートリアルでは、OpenZeppelin ERC20 のワークスペーステンプレートを使用します。もちろん、空のワークスペースを使って独自の smart contract を deploy することもできます。

{% hint style="info" %}
Chiliz の Fan Tokens は CAP-20 トークンであり、これは Ethereum ERC20 トークン標準を Chiliz Chain 向けに拡張したものです。CAP-20 について詳しくはこちら。
{% endhint %}

3. 「OpenZeppelin」テンプレートカテゴリまでスクロールし、「ERC20」テンプレートをクリックします。

<figure><img src="/files/Yh2fYzmzI62jX9N6fa6I" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
[OpenZeppelin](https://www.openzeppelin.com/) は、安全な dApp を構築するためのオープンソースプラットフォームです。

セキュリティおよび監査サービスに加えて、[コミュニティで検証された smart contract のライブラリ](https://docs.openzeppelin.com/contracts/)を提供しており、コミュニティはプロジェクトで自由に利用できます。

OpenZeppelin の contract は業界標準とみなされており、安心して使用できます。
{% endhint %}

4. Remix が表示するフォームを使って ERC20 トークンに名前を付け、「Validate workspace」ボタンをクリックします。

<figure><img src="/files/feyTYOfdKbtAugsF74eJ" alt=""><figcaption></figcaption></figure>

選択を確定すると、Remix は標準的なワークスペースを読み込み、フォルダーとファイルが左側の File Explorer に表示されます。`/contracts/{token name}.sol` ファイルをクリックして、これから deploy する ERC20 contract を表示します。

<figure><img src="/files/rYZmjmJ0LaXA8w6UwsEz" alt=""><figcaption></figcaption></figure>

ご覧のとおり、デフォルトの `MyToken.sol` smart contract は OpenZeppelin の `ERC20.sol` contract をインポートしています。\
\&#xNAN;*`.deps/npm/@openzeppelin/contracts/token/ERC20/ERC20.sol` ファイルを開くと、ERC20 contract 自体を表示できます。*

`MyToken.sol` contract は自由に編集できます。\
たとえば、Chiliz Chain EVM で動作させるには、contract は最大でも Solidity 0.8.24 に依存している必要があるため、次のように変更します。

```solidity
pragma solidity ^0.8.24;
```

... そして、該当するコンパイラを選択します。

<div align="left"><figure><img src="/files/J6tBcUyAKE7cOQxg2pA6" alt="" width="277"><figcaption></figcaption></figure></div>

5. contract ファイルの上部にある「Compil&#x65;**"** をクリックします。\
   ![](/files/ZxGoBlRfTB5dAWWaOgB0)

変更に誤りがなければ、Remix IDE は左側の「Solidity Compiler」メニューに緑色のチェックマークを表示するはずです。

<div align="left"><figure><img src="/files/26ysr0yk354xi2b5TUuj" alt="" width="338"><figcaption></figcaption></figure></div>

6. 「Deploy & run transactions」セクションを開きます。<br>

   <figure><img src="/files/82G7sWZtSJMDWKNqRPbu" alt=""><figcaption></figcaption></figure>

* 「Environment」ドロップダウンメニューで「Browser Extension > Injected Provider - MetaMask」を選択します。これにより、deploy したトークンが MetaMask アカウントにリンクされます。このアカウントはすでに Chiliz Chain で動作するよう設定されているはずです（設定されていない場合は、こちらを参照してください）。
* Remix が正しいネットワーク、Chiliz Chain Mainnet を表示していることを確認します。\
  ![](/files/GEWhaRdDXVVycgXLzUPY)
* contract ファイルが選択されており、選択された EVM バージョンが「Shanghai」であることを確認します。\
  そうでない場合は、コンパイラのバージョンが v0.8.24 に設定されていないことを意味するので（上記参照）、Step 4 に戻ってください。\
  ![](/files/zz9pGPMb1uimX6crnTnD)
* 「Deploy & Verify」をクリックします。\
  \&#xNAN;*contract を deploy してから自分で verify したい場合は、「Verify Contract on Explorers」ボックスのチェックを外すことで、Remix に contract の deploy のみを行わせることができます。*

{% hint style="warning" %}
deploy トランザクションの支払いに十分な CHZ がウォレットにあることを確認してください。
{% endhint %}

7. MetaMask ウォレットが自動的に開くはずです。

<figure><img src="/files/wx4bjtS4j63KySmrO4D1" alt="" width="375"><figcaption></figcaption></figure>

8\. 「Confirm」をクリックして、MetaMask ウォレットをトークンの smart contract にリンクします。\
数秒以内に、トランザクションを確認する通知と、[Chiliscan](https://chiliscan.com/) ブロックエクスプローラーでトランザクションを表示する案内が届くはずです。

トランザクションから、deploy された contract 自体にアクセスできます（ここでは「Contract」の後にあるリンク）。

<figure><img src="/files/aR2j6luYrkqS9sRk4XOh" alt=""><figcaption></figcaption></figure>

MetaMask ウォレットの *"*&#x41;ctivity" タブには、contract の deploy 情報が表示されます。クリックすると、それに関するすべての情報を確認できます。

<figure><img src="/files/c1oAschKyoEIXwch7zXX" alt="" width="329"><figcaption></figcaption></figure>

おめでとうございます！あなたの contract は Chiliz Chain に deploy されました。

次は、それを verify する番です。

[verify-a-smart-contract](/jp/kaihatsu/kihon/smart-contract-verify.md)


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chiliz.com/jp/kaihatsu/kihon/smart-contract-deploy/remix-deploy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
