# 2. Arbitrum IDE 使用流程演示

{% embed url="<https://youtu.be/jikpxzTPe7c>" %}

## 1. 编写合约

进入项目后，文件夹中自带的 readme.md 文件会自动预览。&#x20;

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

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

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

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

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

## 2. 编译合约

合约代码编写完成后，点击右侧菜单栏的 Compiler 按钮打开编译模块，选择 Compiler 版本和是否开启 Optimization，然后点击 Compile \*\*\*.sol 启动编译。

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

编译成功后，下方会显示 [ABI](https://docs.soliditylang.org/en/latest/abi-spec.html) 和 BYTE CODE ，同时控制台上会输出 Compile contract success 的信息提示。

<figure><img src="/files/6JB7fXrTd8H9MhfjZvm7" alt="" width="326"><figcaption></figcaption></figure>

## 3. 连接 Arbitrum

部署合约前，需要先点击右上角的 Connect Wallet，选择连接到 JavaScript VM (使用 JavaScript 实现的 EVM，主要用于测试) 或 Metamask （可部署到 Arbitrum 区块链上）。

<figure><img src="/files/3KyntyIq6J8URR2uWgN5" alt=""><figcaption></figcaption></figure>

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

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

## 4. 部署合约

点击右侧的 Deploy & Interaction 按钮，出现部署页与交互页面。选择好已编译的合约后，点击 Deploy进行部署（然后在 Metamask 中点击确认）。合约部署成功后，控制台上会输出现合约部署的结果以及相关信息。&#x20;

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

除此之外，你还可以点击 Import Deployed Contract 导入已部署过的合约，来进行合约交互。

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

## 5. 合约交互

合约部署成功后，可以对合约进行交互操作。点击已部署好的合约，选择对应的接口，点击 Submit 或 Get   进行交互。

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

## 6. 交易查询

点击 Output 中的交易 Hash，可以查看每笔交易的具体信息。

<figure><img src="/files/7c1kAlPLzwq5t98dxmWi" alt=""><figcaption></figcaption></figure>

## 7. 验证合约

如果你想在区块链浏览器上开源你的智能合约，请参考 [ChainIDE Verifier](/chainide-chinese/4.-chainide-quan-ti-bu-ju/4.7.-cha-jian-xi-tong-mo-kuai/2.7.3-chainide-verifier.md) 或 [ChainIDE Flattener](/chainide-chinese/4.-chainide-quan-ti-bu-ju/4.7.-cha-jian-xi-tong-mo-kuai/2.7.2.-chainide-flattener-plugin.md)。

## 8. Arbitrum Sandbox&#x20;

如果你喜欢使用命令行进行开发，可以打开 Arbitrum Sandbox，其中已自带 [Hardhat](https://hardhat.org/), [Truffle](https://trufflesuite.com/), [Brownie](https://eth-brownie.readthedocs.io/en/stable/) [Ganache](https://trufflesuite.com/ganache/), [Git](https://git-scm.com/) 和 [Node.js V16](https://nodejs.org/en)。

<figure><img src="/files/7GjNAr79f4xd4rzx2wkN" alt=""><figcaption></figcaption></figure>

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


---

# Agent Instructions: 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://chainide.gitbook.io/chainide-chinese/chainide/14.-arbitrum-ide/2.-arbitrum-ide-shi-yong-liu-cheng-yan-shi.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.
