> 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/5.-nervos-ide/3.-shi-yong-ganache-v7.md).

# 3. 使用 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/6hRp8915E67JQRfkMq1g" alt=""><figcaption></figcaption></figure>

## 2. 启动 Ganache

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

```
ganache -h 0.0.0.0
```

<figure><img src="/files/Kirb7UhPj1QspBzKaozt" 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)
