> 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/14.-arbitrum-ide/4.-shi-yong-ganache-v7.md).

# 4. 使用 Ganache v7

{% hint style="info" %}
Consensys 宣布终止与 Truffle 和 Ganache 的合作关系以及和 HardHat 新的合作关系，[更多详情](https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github\&utm_medium=referral\&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_)。
{% endhint %}

## 1. 打开 Sandbox

注：以 GIthub 方式登录 ChainIDE 后才可使用 Sandbox 功能。

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

打开 Sandbox

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

## 2. 启动 Ganache

通过输入带参数的 ganache 来启动一条 terminal 之外的客户端也可以访问的本地链：

```
ganache -h 0.0.0.0
```

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

## 3. 端口转发

为了其他客户端可以通过链接访问到上图启动的 ganache，请参考 [ChainIDE - 端口转发](/chainide-chinese/5.-port-forwarding.md) 转发 HTTP 8545 端口，并复制其地址 (例如：<https://sandbox-1e82a87a951241179f98494a6dbb2617-ethereum-8545.uat-sandbox.chainide.com>)。

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

{% hint style="info" %}
这样你就成功的启动了一条 ganache 本地区块链。接下来可以通过 Metamask 连上该条链，或者通过 Truffle, Hrdhat 部署合约, chain id 为 1337。
{% endhint %}

#### 相关链接

* [ganache 文档](https://trufflesuite.com/docs/ganache/)
* [ganache github仓库](https://github.com/trufflesuite/ganache)


---

# 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, and the optional `goal` query parameter:

```
GET https://chainide.gitbook.io/chainide-chinese/chainide/14.-arbitrum-ide/4.-shi-yong-ganache-v7.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
