> For the complete documentation index, see [llms.txt](https://chainide.gitbook.io/chainide-chinese/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chainide.gitbook.io/chainide-chinese/chainide/16.-mina-ide/2.-mina-ide-shi-yong-liu-cheng-yan-shi.md).

# 2. Mina IDE 使用流程演示

## 1. 编写合约 <a href="#id-1.-bian-xie-he-yue" id="id-1.-bian-xie-he-yue"></a>

进入项目后，可以点击文件夹中 readme.md 右上角 preview 进行预览。

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

在 Explorer 栏中，你可以新建文件（夹），刷新目录，下载文件。也可以直接点击模板中自带的文件。

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

点击一个合约文件，即可对代码进行编辑操作。

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

### 2. 编译合约 <a href="#id-2.-ce-shi-he-yue" id="id-2.-ce-shi-he-yue"></a>

在右侧菜单栏的 Compiler 中，选择 Module Package Path 后，点击 Compile 即可开始编译合约。

<figure><img src="/files/5axH1eJ0YzYiwzT2tBjW" alt=""><figcaption></figcaption></figure>

编译成功后，会在当前目录下生成 build 文件夹。

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

### 3. 部署合约 <a href="#id-5.-bu-shu-he-yue" id="id-5.-bu-shu-he-yue"></a>

点击右侧的 Deploy & Interaction 按钮，出现部署页与交互页面。选择好 Module Package Path 后，先点击 Config 进行部署账户配置

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

例如 (对于 Testnet)：

* Deploy alias name: `devnet`

  This tutorial uses `devnet`, but the deploy alias name can be anything and does not have to match the network name.
* Target network kind: `Testnet`
* Mina GraphQL API URL: `https://api.minascan.io/node/devnet/v1/graphql`
* Transaction fee to use when deploying (in MINA): `0.1`
* Use a different account (select to see options): `Create a new fee payer key pair`

例如 （对于 Mainnet）：

* Deploy alias name: `mainnet`

  This tutorial uses `devnet`, but the deploy alias name can be anything and does not have to match the network name.
* Target network kind: `Mainnet`
* Mina GraphQL API URL: `https://api.minascan.io/node/mainnet/v1/graphql`
* Transaction fee to use when deploying (in MINA): `0.1`
* Use a different account (select to see options): `Create a new fee payer key pair`

Config 完成后，点击 Sandbox 中的 faucet 链接获取测试代币。

<figure><img src="/files/8hLPF5m84LuNqPD5lNYN" alt=""><figcaption></figcaption></figure>

成功获取测试币后，点击 Deploy，选择合适的 Deploy Alias 进行部署。

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

等待一会儿，sandbox 会显示部署链接，点击该链接以确定部署交易已上链。

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

### 4. 合约交互 <a href="#id-6.-he-yue-jiao-hu" id="id-6.-he-yue-jiao-hu"></a>

合约部署成功后，可以对合约进行交互操作。点击已部署好的合约，选择对应的参数，点击 Interact 进行交互。

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

### 5. Mina Sandbox <a href="#id-8.-sui-sandbox" id="id-8.-sui-sandbox"></a>

如果你喜欢使用命令行进行开发，可以打开 Mina Sandbox，其中已自带 [zkApp CLI](https://www.npmjs.com/package/zkapp-cli), [Git](https://git-scm.com/) 和 [Node.js V20](https://nodejs.org/en)。

<figure><img src="/files/9BcXgUTX0HgDkOZLmt9y" alt=""><figcaption></figcaption></figure>

如果你在 Sandbox 中启动了一个端口，并且想要访问该端口，请参考 [ChainIDE-端口转发](https://chainide.gitbook.io/chainide-chinese/5.-port-forwarding)。
